当前位置:Gxlcms > 数据库问题 > mysql导入导出文本文件

mysql导入导出文本文件

时间:2021-07-01 10:21:17 帮助过:14人阅读

45

导出文本文件

在导出时可能存在问题: 提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法

SHOW VARIABLES LIKE "secure_file_priv"    后查看变量得值:

secure_file_prive=null   -- 限制mysqld 不允许导入导出

secure_file_priv=/tmp/   -- 限制mysqld的导入导出只能发生在/tmp/目录下 默认都是这个

secure_file_priv=‘ ‘         -- 不对mysqld 的导入 导出做限制

因此直接导入到临时目录下:

select * from test  into outfile ‘e:/wamp64/tmp/outfile_3.txt‘ lines terminated by "\r\n";

lines terminated by ‘\r\n’——每条数据以换行存在

注意

字段之间的分隔和记录(行)之间的分隔默认是\t和\n,但我们可以自己设置。

fileds terminated by  ‘设置分隔符’——字段之间进行分隔

lines terminated by  ‘设置分隔符’——行分隔符

技术分享

mysql导入导出文本文件

标签:解决办法   with   但我   之间   --   blog   数据   padding   错误   

人气教程排行