[mod_python] Re: Mod_python Digest, Vol 25, Issue 19 - MySQL issues.

Barry Pearce barry.pearce at copyrightwitness.net
Sat Apr 16 16:10:39 EDT 2005


Hi All,

>    2. mod_python to MySQL (Dave Britton)
>    3. Re: mod_python to MySQL (Jorey Bump)
>    5. Re: mod_python to MySQL (azurIt)
> ------------------------------
> 
> Message: 2
> Date: Fri, 15 Apr 2005 15:40:09 -0400
> From: "Dave Britton" <dave at davebritton.com>
> Subject: [mod_python] mod_python to MySQL
> 
> What's the best way to connect mod_python to a MySQL database? I can't seem to get MySQL_db to install - it says: 

MySQLdb without a doubt. Works VERY well with mod_python - Im use 
mod_python 3.1.3 python 2.3.4 and MySQL 4.1.10a with MySQLdb 1.20 (under 
   Linux) and 1.0.0 (under win32 but needs patching with a small fix for 
timestamp fields...i can send it!)

> =======
> gcc -pthread -shared build/temp.linux-i686-2.3/_mysql.o -lmysqlclient -lz -lcrypt -lnsl -lm] -lmysqlclient_r -o build/lib.linux-i686-2.3/_mysql.so
> /usr/bin/ld: cannot find -lmysqlclient
> collect2: ld returned 1 exit status
> error: command 'gcc' failed with exit status 1
> ======
> and I wondered if there is another connector that is better suited for mod_python. Or, does anyone have any ideas about why I get the gcc library linking error if MySQL_db is the connector of choice.

Firstly you probably dont want mysqlclient. You probably want 
mysqlclient_r which is the reentrant thread-safe version. You link line 
seems to have both - very worrying...Ill check my compilation...

Is MySQL located in default location? Where did you install it to? Have 
you checked the include & library paths to make sure the MySQL libs and 
includes are on the right path.

I compiled up 1.2.0 only 2 days ago under SuSE9.0 with no problems.

 > ------------------------------

>>What's the best way to connect mod_python to a MySQL database? I can't 
>>seem to get MySQL_db to install - it says:
>>=======
>>gcc -pthread -shared build/temp.linux-i686-2.3/_mysql.o -lmysqlclient 
>>-lz -lcrypt -lnsl -lm] -lmysqlclient_r -o build/lib.linux-i686-2.3/_mysql.so
>>/usr/bin/ld: cannot find -lmysqlclient
>>collect2: ld returned 1 exit status
>>error: command 'gcc' failed with exit status 1
>>======
> 
> 
> What Linux distribution are you using? Do you have the mysqlclient 
> development files installed?

Now I dont have these installed. I think I also downloaded the dynamic 
client libraries RPM in addition to the standard package.

> ------------------------------
> 
> Message: 5
> Date: Sat, 16 Apr 2005 10:12:04 +0200
> From: azurIt <azurit at pobox.sk>
> Subject: Re: [mod_python] mod_python to MySQL
> To: Mod_python at modpython.org

> the problem can be also in MySQL version - older versions of 4.0.x 
> are not supported and it's even not possible to compile MySQL-python 
> (i had the same problem). If you are useing MySQL 4.0.x try to 
> upgrade to the latest version (for now it's 4.0.24).


Current stable is 4.1.10a. MySQLdb works well with this 1.2.0 is the 
best. But if you need it on windows use the 1.0.0 binary and then patch 
the times.py file.

-- 
Regards

Barry Pearce


More information about the Mod_python mailing list