問題
Mysql命令臺導出導入數據報錯:
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
原因
mysql的secure_file_priv這個選項沒有開啓,或者設置了指定的文件路徑,只有在這個路徑下的文件才能導入導出mysql。
解決方法
1.使用命令行查詢mysql 的secure_file_priv值
show variables like "secure_file_priv";
secure_file_priv的值以及含義:
secure_file_priv值 | 含義 |
---|---|
NULL | 禁止文件的導入導出 |
'' | 允許所有文件的導入導出 |
路徑地址 | 只有該路徑地址下的文件可以導入導出到mysql |
2.找到mysql安裝包下的my.ini文件,然後在[mysqld]這個選項下加入或者修改變量secure_file_priv,根據自己的情況設置值,如:
secure_file_priv=''
3.重啓mysql服務