[root@potato Desktop]# mysqldump -uroot -proot -S /tmp/mysql.sock --tab=/data/mysql/mytest_3306/data/backup lala
Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'
當secure_file_priv的值沒有具體值時,表示不對mysqld 的導入|導出做限制
查看數據庫當前該參數的值
root@localhost:mysql.sock 00:14:52 [(none)]>show global variables like '%secure%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_auth | ON |
| secure_file_priv | NULL |
+------------------+-------+
2 rows in set (0.00 sec)
清楚地看到secure_file_priv 的值是NULL,說明此時限制導入導出的
所以應該改變該參數
可是查看了mysql.cnf中居然沒有對這個參數進行設定,就說明這個參數默認便是null
所以再mysql.cnf中的[mysqld]加入secure_file_priv =
再重啟mysql服務
然后再查一下此時參數的值
root@localhost:mysql.sock 00:28:30 [(none)]>show global variables like '%secure%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_auth | ON |
| secure_file_priv | |
+------------------+-------+
2 rows in set (0.00 sec)
已經是我們要的結果
開始進行導出
[root@potato Desktop]# mysqldump -uroot -proot -S /tmp/mysql.sock --tab=/data/mysql/mytest_3306/data/backup lala
Warning: Using a password on the command line interface can be insecure.
可以看到成功了