I am running Ubuntu 12.04 and MySQL 5.5 Alright so here is the problem:
Using the MySQLDB module for Python, the SQL command:
cursor.execute("LOAD DATA LOCAL INFILE 'example.csv' INTO TABLE 'example_mysql_table' TERMINATED BY ',';")
Doesn't work. I get ERROR 1148: The used command is not allowed with this MySQL version
I have looked around for a solution for this for a while now, and so far it seems other people having the same problem have fixed it by adding "local-infile = 1" to 'my.cnf' underneath [mysqld] and [mysql]. This has not worked for me, and I am not sure why.
Relevant Link:
MySQL: Enable LOAD DATA LOCAL INFILE
After spending hours on trying all kinds of settings in the config files and restarting mysql dozens of times I came up with this which seems to solve the problem (could not find this in any documentation anywhere)
MySQLdb.connect(server, username, password, database, local_infile = 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With