New MySQLdb problem

Status
Not open for further replies.

beyondin

New Member
Messages
4
Reaction score
0
Points
0
When attempting to use MySQLdb to connect to mysql.x10hosting.com I get an exception. The exception suggests that the MySQLdb build is incompatable with the current MySQL installation. I'll post it below along with a FAQ entry from the MySQLdb page, and the code.

The exception: libmysqlclient_r.so.14: cannot open shared object file: No such file or directory

FAQ page: http://mysql-python.sourceforge.net/FAQ.html#importerror

From the FAQ page:

ImportError: libmysqlclient_r.so.14: cannot open shared object file: No such file or directory​
The number after .so may vary, but this means you have a version of MySQLdb compiled against one version of MySQL, and are now trying to run it against a different version. The shared library version tends to change between major releases.
Solution: Rebuilt MySQLdb, or get the matching version of MySQL.
Another thing that can cause this: The MySQL libraries may not be on your system path.
Solutions:
  • set the LD_LIBRARY_PATH environment variable so that it includes the path to the MySQL libraries.
  • set static=True in site.cfg for static linking
  • reconfigure your system so that the MySQL libraries are on the default loader path. In Linux, you edit /etc/ld.so.conf and run ldconfig. For Solaris, see Linker and Libraries Guide.

And the code that demonstrates the error (of course I've changed the db, user, and passwd settings for posting purposes):

Code:
#!/usr/bin/python
print "Content-type: text/html\n\n"
# attempt to connect to database
try:
    import MySQLdb
    db=MySQLdb.Connect(db='example_db', host='mysql.x10hosting.com', user='example_user', passwd='example_pwd')
    cursor=db.cursor()
    cursor.execute('SELECT version()')
    data=cursor.fetchall()
    cursor.close()
    db.close()
    print data
except Exception, e:
    print e













Edit:
A little surprised no one else has mentioned this but it seems the cossacks build of the python module MySQLdb is not compatible with the the new MySQL version on the new server. Can we get a new install of MySQLdb please? Thanks and much appreciated.

Here's some test code that currently throws the exception libmysqlclient_r.so.14: cannot open shared object file: No such file or directory:

file: import_MySQLdb.py
Code:
#!/usr/bin/python

print "Content-type: text/html\n\n"

#attempt to import MySQLdb
try:
    import MySQLdb
    print "MySQLdb imported successfully"
except Exception, e:
    print e
MySQLdb Home on Sourceforge:
http://sourceforge.net/projects/mysql-python
 
Last edited:

mr kennedy

Member
Messages
524
Reaction score
1
Points
18
Try this and tell me if it solves your problem:

Go to cPanel
Go to 'Remote MySQL'
Add %.x10hoting.com
 

beyondin

New Member
Messages
4
Reaction score
0
Points
0
I've tried adding the db field to the remote mysql field but that does not help. Thanks, though.

Yes, it seems a Python issue, specifically the Python-MySQL adapter (MySQLdb) is not communicating between the two properly.

As the FAQ listing quoted above indicates, this is likely due to mismatched MySQL and MySQLdb builds. Just guessing, but maybe the new server has a newer version of MySQL than the older MySQLdb can work with?
 

Slothie

New Member
Messages
1,429
Reaction score
0
Points
0
Yep, that just about sums it up. Again, this isn't very high on the list of priorities at the moment since there are not that many python users on x10 that I know of.

It'll probably be taken care of once we stabilize the servers.
 

beyondin

New Member
Messages
4
Reaction score
0
Points
0
Yep, that just about sums it up. Again, this isn't very high on the list of priorities at the moment since there are not that many python users on x10 that I know of.

It'll probably be taken care of once we stabilize the servers.

I took a shovel and dug a deep hole, raised up a coffin, ripped the doors off, and applied the lightning to the neck-bolts of this thread. And offer this: http://rgscompete.x10hosting.com/pytest.py
 

beyondin

New Member
Messages
4
Reaction score
0
Points
0
http://rgscompete.x10hosting.com/pytest.py

Code:
#!/usr/bin/python

#attempt to import MySQLdb
try:
     import MySQLdb
     print "MySQLdb imported successfully"
except Exception, e:
         print e
Sun Dec 30 12:53:49 2007 And the status of the MySQLdb module on this server is: libmysqlclient_r.so.14: cannot open shared object file: No such file or directory

MySQLdb is still not able to be imported. A proper build needs installed!
 
Status
Not open for further replies.
Top