Jump to content
The Uniform Server Community
labete

python & mysql

Recommended Posts

Sorry, I found out by myself. I leave the topic in case it could help someone

 

Hi!

 

I am trying to install a local mysql server to use with python. Fail so far:

 

the mini servers 11 and 12 seem to work fine: I can browse the user table in mysql db.

I have python 2.6 installed alongside mysql-python1.2.3

 

But I cannot connect to the mini server thru python:

 

import MySQLdb

c=MySQLdb.connect(host="127.0.0.1:3312",user="root",passwd="test",db="mysql")

or

c=MySQLdb.connect("localhost:3311","root","test","mysql")

or

any combination of the above outputs ST like:

OperationalError: (2005, "Unknown MySQL server host '127.0.0.1:3312' (11001)")

 

So, do I do anything wrong? Any advice?

Thanks

One has to type instead:

c=MySQLdb.connect(host="127.0.0.1", port=3312,user="root",passwd="test",db="mysql")

or

c=MySQLdb.connect("localhost","root","test","mysql", 3312)

 

HTH n sorry if i botherd you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...