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 現有的基礎上添加用戶權限