在windows系統的MySQL8.0中嘗試執行如下語句時報錯mysql
mysql> LOAD DATA LOCAL INFILE '/path/filename' INTO TABLE tablename;
sql
ERROR 1148 (42000): The used command is not allowed with this MySQL versionwindows
所用的指令在當前MySQL版本不被容許,this
但其實MySQL5.1及以上都支持此命令,報這個錯是由於MySQL中系統變量local-infile=0時不容許本地加載數據,在安裝目錄找到配置文件my.ini,修改其中的local-infile=1,或在啓動MySQL時添加--local-infile選項code
mysql -uroot --local-infile=1 -pserver
password:******input
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statementit
MySQL服務正在以--secure-file-priv選項運行,所以沒法執行這個語句,io
出錯的緣由是由於在MySQL 5.7.6版本以後,導入文件只能在secure_file_priv指定的文件夾下(也有緣由是由於權限不夠),咱們能夠用show variables like '%secure%';命令顯示文件目錄,把須要導入的文件放在secure-file-priv參數指定的文件夾下,以後再從這裏導入就能夠了table
ERROR 2 (HY000): File not found (OS errno 2 - No such file or directory)
文件未找到,
在windows系統下提供文件路徑時須要將全部"\變爲「\\」,如C:\\Program Files\\MySQL\\MySQL Server 8.0\\file