Loading local data is disabled; this must be enabled on both the client and server sides 


mysql使用文件導入數據是報錯:

Loading local data is disabled; this must be enabled on both the client and server sides

臨時解決辦法:

命令行輸入mysql登錄命令:

mysql --local-infile=1 -u root -p 

設置變量:SET GLOBAL local_infile=1;

查看變量:show global variables like 'local_infile';

mysql> show global variables like 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set (0.00 sec)

導入文件沒有問題,但是重啟mysql服務,依然會提示以上錯誤

永久解決辦法:就是在mysql服務啟動時自動加載該配置,修改mysql配置文件

mysqld.cnf中的

[mysqld]
下添加
local_infile = 1  

mysql.cnf中的

[mysql]

下添加
local_infile = 1

mysql服務重啟

service mysql restart

命令行查看local_infile變量狀態

mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set (0.00 sec)

說明配置成功

導入文件正常

 local_infile服務器變量指示能否使用load data local infile命令。該變量默認為ON。 
該變量為OFF時,禁用客戶端的load data local infile命令。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM