当前位置: 动力学知识库 > 问答 > 编程问答 >

mysql - enable LOCAL INFILE with PHP on Linux

问题描述:

I'm having some issues loading some data into MySQL on Linux. I'm using LOAD DATA LOCAL INFILE. I can do it just fine on Mac OS X, specifically through the MySQL command line and a php script with a SQL query.

The issue arises when I'm on linux, it seems like LOAD DATA LOCAL is disabled per the MySQL documentation for security issues. To get around this problem, they give some possible workarounds such as using --local-infile[=1] on starting MySQL, but what am I suppose to do if I'm using PHP?

Specifically, in the command line, I get the error:

ERROR 1148 (42000): The used command is not allowed with this MySQL version

I'm also using version:

mysql Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (x86_64) using readline 6.3

Any help would be greatly appreciated.

网友答案:

You can set it from an sql statement, assuming you have the correct permissions to change global variables;

SET GLOBAL local_infile = 'ON';

Check to see if the changes have taken effect;

SHOW GLOBAL VARIABLES LIKE 'local_infile';
分享给朋友:
您可能感兴趣的文章:
随机阅读: