Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am running a Rails site with a MySQL database.

I start the MySQL server daemon using:

sudo /usr/local/mysql/support-files/mysql.server start

After attempting to upload some data with my site, I noticed this in the log file:

Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE

I stopped MySQL, and restarted it using:

sudo /usr/local/mysql/support-files/mysql.server start 
        --local-infile=1

However, it still doesn't upload anything, and shows the same errors.

What am I doing wrong?

share|improve this question
Please post the LOAD DATA LOCAL INFILE command and SHOW VARIABLES LIKE 'load_infile'; – RolandoMySQLDBA Sep 26 '12 at 19:37
@RolandoMySQLDBA: Actually, it was ok after I restarted my rails application. Perhaps I should close the question now, or could this be useful to other people? – highBandWidth Sep 27 '12 at 14:20

1 Answer

I am just starting the mysql tutorial, but I thought maybe this answer would help others. The LOAD DATA LOCAL command needs the mysql server to allow itself to access local files on the client. The problem is addressed on this page. As @highBandWidth noted in his question, he enabled this option when starting the server and this worked for him. To enable it by default, I followed recommendations on a comment on the load data local page (linked above):

edit my.cnf in /etc/mysql/:
----------------------------------------
[mysqld]
...(other stuff)
local-infile=1
[mysql]
...(other stuff)
local-infile=1 

I then used sudo mysqladmin shutdown (maybe with the -p option) and it seemed to work.

I don't know what the community thinks about the 'security' of doing this, though. For me, I am just learning mysql on my own ubuntu laptop, so it seems fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.