mysql 导出数据到文件 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so
2017-03-20 18:06
1151 查看
在做mysql 大批量导出数据的时候,所遇到的问题如下:
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
mysql 默认对导出的目录有权限限制,也就是说使用命令行进行导出的时候,需要指定目录进行操作;
解决方法:
1. 查询mysql 的secure_file_priv 值配置的是什么,使用命令行: show global variables like '%secure%';
(我这里的配置是 secure_file_priv = /var/lib/mysql-files/)
2. 使用 into outfile 开始导出:(因为secure_file_priv配置的关系,所以必须导出到 /var/lib/mysql-files/目录下)
select * from table_name where a = 'test'
into outfile '/var/lib/mysql-files/test.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
3.所用的几个关键字:
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY ' " ' LINES TERMINATED BY '\n';
(因为导出的数据会出现一些乱码或者特殊字符,所以使用以上关键字进行转义)
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
mysql 默认对导出的目录有权限限制,也就是说使用命令行进行导出的时候,需要指定目录进行操作;
解决方法:
1. 查询mysql 的secure_file_priv 值配置的是什么,使用命令行: show global variables like '%secure%';
(我这里的配置是 secure_file_priv = /var/lib/mysql-files/)
2. 使用 into outfile 开始导出:(因为secure_file_priv配置的关系,所以必须导出到 /var/lib/mysql-files/目录下)
select * from table_name where a = 'test'
into outfile '/var/lib/mysql-files/test.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
3.所用的几个关键字:
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY ' " ' LINES TERMINATED BY '\n';
(因为导出的数据会出现一些乱码或者特殊字符,所以使用以上关键字进行转义)
相关文章推荐
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it ...statemet
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec
- mysql>导出数据为txt时报错:The MySQL server is running with the --secure-file-priv option so it cannot execut
- MYSQL导出数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this
- mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it can
- Windows sql语句正则匹配导出数据到本地 The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
- mysql导出表到CSV文件方法及提示错误[Err] 1290 - The MySQL server is running with the --secure-file-priv option解决办法
- MYSQL 5.7报错 Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it..
- [Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement]错误解决
- MySQL用into outfile导出出错The MySQL server is running with the --secure-file-priv option so it cannot ex
- Windows下MySQL导入csv文件ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv opti
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe
- MySQL 报错Error Code: 1290. The MySQL server is running with the --secure-file-priv option
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe