Solved MySQL, MySQLdb problems

Edward C. Jones edcjones at
Wed Oct 16 18:26:47 CEST 2002

I have solved my problem with MySQL and MySQLdb. The problem was:

 >   I have installed mysql-3.23.52 as part of the Gentoo Linux
 >   distribution. I am accessing MySQL via mysql-python AKA MySQLdb
 >   which calls the MySQL C API. During testing I start MySQL using
 >   "safe_mysqld" and shutdown MySQL using "mysqladmin -u root
 >   --password=xxxxxxxx shutdown".

 >   When I do a "LOAD DATA LOCAL INFILE" via MySQLdb, I get the
 >   well-known error message 1148: "The used command is not allowed
 >   with this MySQL version".

1. Add to mysql-3.23.52.ebuild the line

myconf="${myconf} --enable-local-infile"

It goes in the src_compile() section. Do an "emerge dev-db/mysql" to 
rebuild MySQL. This is the same as running config with the 
"--enable-local-infile" option.

2. Recompile mysql-python (which contains MySQLdb). I suspect the 
segfaults I was having were due to library mismatches. Therefore build 
MySQLdb after MySQL.

3. Add "local-infile" to "/etc/mysql/my.cnf" in the groups [safe_mysql], 
[mysqld], and [mysql]. Do not add it to the group [client].

4. At some point the MySQL GRANT system was changed. Now

GRANT FILE ON my_database.* TO abcdefgh at localhost IDENTIFIED BY  xxxxxxxx';

does not work. One must use:

GRANT FILE ON *.* TO abcdefgh at localhost IDENTIFIED BY 'xxxxxxxx';

Note that now abcdefgh can access any file on any database. I wish I 
could use "LOAD DATA LOCAL INFILE" is a more secure manner.

More information about the Python-list mailing list