Note that there are some explanatory texts on larger screens.

plurals
  1. POLOAD DATA LOCAL INFILE fails - from php, to mysql (on Amazon rds)
    text
    copied!<p>We're moving our database from being on the webserver to a separate server (from an Amazon EC2 webserver to an RDS instance.)</p> <p>We have a LOAD DATA INFILE that worked before that is going to need the LOCAL keyword added now that the database will be on a different machine to the webserver.</p> <p>Testing on my dev server, it turns out that it doesn't work:</p> <ul> <li>I can still LOAD DATA INFILE from php as I have been</li> <li>I can LOAD DATA LOCAL INFILE from mysql commandline (with --local_infile=1)</li> <li>I can't LOAD DATA LOCAL INFILE from php.</li> </ul> <p>Between those 2 things that do work, it rules out:</p> <ul> <li>problems with the sql or php code</li> <li>problems with the upload file, including syntax and file permissions</li> <li>mysql server settings problems</li> </ul> <p>The error I get is: ERROR 1148 (42000): The used command is not allowed with this MySQL version (I get that error from the mysql commandline if I don't use --local_infile=1)</p> <hr> <p>A few other bits of relevant info:</p> <ul> <li>Ubuntu 12.04, mysql 5.5.24, php 5.3.10</li> <li>I'm using php's mysql_connect (instead of mysqli, because we're planning on using facebook's hiphop compiler which doesn't support mysqli.)</li> <li><p>Because of that, the connect command needs an extra flag set:</p> <pre><code>mysql_connect($dbHost, $dbUser, $dbPass, false, 128); </code></pre></li> <li>I've used phpinfo() to confirm that <code>mysql.allow_local_infile = On</code></li> <li>I've tried it on Amazon RDS (in case it was a problem in my dev server) and it doesn't work there either. (With the local_infile param turned on.)</li> </ul> <p>The only thing I've read about that I haven't tried is to compile mysql server on my dev server with the flag turned on to allow local infile... but even if I get that working on my dev server it's not going to help me with Amazon RDS. (Besides which, LOAD DATA LOCAL INFILE does work from the mysql commandline.)</p> <hr> <p>It seems like it's specifically a problem with php's mysql_connect()</p> <p>Anybody using LOAD DATA LOCAL INFILE (maybe from Amazon RDS) that knows the trick to getting this to work?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload