导出mysql的表格内容到txt文件
2017-08-30 15:18
309 查看
操作流程:
注意:上面命令中的路径不可以随意乱指定,如改成/tmp/uc3dp_v1.0_userinfo.txt就会报错:
原因是mysql设置了安全措施,必须将文件输出到其指定目录才行。可以通过如下命令查看系统设置的默认目录:
$ mysql -uroot -p mysql> use foo; mysql> select * from userinfo into outfile '/var/lib/mysql-files/uc3dp_v1.0_userinfo.txt' fields terminated by ', ' lines terminated by '\n';
注意:上面命令中的路径不可以随意乱指定,如改成/tmp/uc3dp_v1.0_userinfo.txt就会报错:
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
原因是mysql设置了安全措施,必须将文件输出到其指定目录才行。可以通过如下命令查看系统设置的默认目录:
mysql> SHOW VARIABLES LIKE "secure_file_priv"; +------------------+-----------------------+ | Variable_name | Value | +------------------+-----------------------+ | secure_file_priv | /var/lib/mysql-files/ | +------------------+-----------------------+ 1 row in set (0.01 sec)
相关文章推荐
- 如何将navicat for mysql 中查询出来的内容导出到xls文件中
- java解析txt文件的内容然后插入mysql
- 用 PHP 导出 MySQL 数据库内容为 .sql 文件
- INUX 下 MYSQL 如何 将查询结果 导出到TXT 文件
- mysql 导入导出Excel、txt文件数据
- HPH+Mysql注入点利用 读取文件内容和导出一句话木马
- php 导出txt文件 内容换行
- mysql txt文件的导入导出
- 如何在linux下查看内容过长文件(例如.历史日志)并导出为txt文件
- mysql 导出数据到txt文件
- sqlserver数据导出为txt文件再导入mysql
- mysql 导出数据到txt文件
- Navicat for MySQL 导出txt文件无法导入
- atitit.sql server2008导出导入数据库大的表格文件... oracle mysql
- PYTHON实现把PPT文档中的内容导出到TXT文件中
- atitit.sql server2008导出导入数据库大的表格文件... oracle mysql
- linux(ubuntu) mysql 内容导出到配置文件
- 将txt文件内容导入mysql中,出现invalid utf8 character string错误的解决
- mysql 导入导出大文件.sql 内容包含二进制码
- 向mysql中导入导出txt文件