mysql 


mysql 导出数据到文件 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option 


mysql 默认对导出的目录有权限限制,也就是说使用命令行进行导出的时候,需要指定目录进行操作;

解决方法:

1. 查询mysql 的secure_file_priv值配置的是什么,使用命令行:?show global variables like '%secure%'; 


2. 使用into outfile开始导出:(因为secure_file_priv配置的关系,所以必须导出到/var/lib/mysql-files/目录下)



3.所用的几个关键字:

FIELDS TERMINATED BY ',' ?OPTIONALLY ENCLOSED BY ' " '  LINES TERMINATED BY '\n';


导出

select * into outfile '/tmp/snc_item_type.txt' fields terminated by '~' lines terminated by '\r\n' from (select * from snc_item_type) a;


导入

LOAD DATA INFILE '/tmp/snc_item_type0711.txt' INTO TABLE snc_item_typebak  fields terminated by '~' lines terminated by '\r\n' 



grant all privileges on *.* to  root 现有的基础上添加用户权限