問題描述
我在 Ubuntu 12 LTS 上運行 Mysql 5.5.我應該如何在 my.cnf 中啟用 LOAD DATA LOCAL INFILE?
I'm running Mysql 5.5 on Ubuntu 12 LTS. How should I enable LOAD DATA LOCAL INFILE in my.cnf?
我已經嘗試在我的配置中的各個地方添加 local-infile,但我仍然收到此 MySQL 版本不允許使用的命令"
I've tried adding local-infile in my config at various places but I'm still getting the "The used command is not allowed with this MySQL version"
推薦答案
來自 MySQL 5.5 手冊頁:
From the MySQL 5.5 manual page:
LOCAL 僅在您的服務器和客戶端都已配置為允許它.例如,如果 mysqld 以--local-infile=0, LOCAL 不起作用.請參見第 6.1.6 節LOAD DATA LOCAL 的安全問題".
LOCAL works only if your server and your client both have been configured to permit it. For example, if mysqld was started with --local-infile=0, LOCAL does not work. See Section 6.1.6, "Security Issues with LOAD DATA LOCAL".
您應該設置選項:
local-infile=1
進入 my.cnf 文件的 [mysql] 條目或使用 --local-infile 選項調用 mysql 客戶端:
into your [mysql] entry of my.cnf file or call mysql client with the --local-infile option:
mysql --local-infile -uroot -pyourpwd yourdbname
您必須確保在您的 [mysqld] 部分中也定義了相同的參數,以啟用本地 infile"功能服務器端.
You have to be sure that the same parameter is defined into your [mysqld] section too to enable the "local infile" feature server side.
這是一個安全限制.
這篇關于MySQL:啟用 LOAD DATA LOCAL INFILE的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!