473,581 Members | 6,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQLdb Python API: Unable to connect

Hi,

I am using MySQL 5.0 beta and Active Python 2.4. I have the correct
version of MySQLdb installed. The problem is that I can't connect to
MySQL through the Active Python interactive window.

Here is a sample error:
c=MySQLdb.Conne ct(host='localh ost',user='root ',passwd='',db= 'shop',port=330 6) Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python24\Li b\site-packages\MySQLd b\__init__.py", line 66, in
Connect
return Connection(*arg s, **kwargs)
File "C:\Python24\Li b\site-packages\MySQLd b\connections.p y", line
134, in __init__
super(Connectio n, self).__init__( *args, **kwargs2)
OperationalErro r: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

Please look at the penultimate line again. Here the self argument is
placed second to Connection argument. So I reversed their position. But
the problem persists.

Here is a sample:
c=MySQLdb.Conne ct(host='localh ost',user='root ',passwd='',db= 'shop',port=330 6)

Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python24\Li b\site-packages\MySQLd b\__init__.py", line 66, in
Connect
return Connection(*arg s, **kwargs)
File "C:\Python24\Li b\site-packages\MySQLd b\connections.p y", line
134, in __init__MyM
super(self,Conn ection).__init_ _(*args, **kwargs2)
OperationalErro r: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

What is happening?

Thanks in advance for any help

Regards
Mondal

Dec 26 '05 #1
2 4499
"Mondal" <ms******@gmail .com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Hi,

I am using MySQL 5.0 beta and Active Python 2.4. I have the correct
version of MySQLdb installed. The problem is that I can't connect to
MySQL through the Active Python interactive window.

Here is a sample error:
c=MySQLdb.Conne ct(host='localh ost',user='root ',passwd='',db= 'shop',port=330 6
)
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python24\Li b\site-packages\MySQLd b\__init__.py", line 66, in
Connect
return Connection(*arg s, **kwargs)
File "C:\Python24\Li b\site-packages\MySQLd b\connections.p y", line
134, in __init__
super(Connectio n, self).__init__( *args, **kwargs2)
OperationalErro r: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

Please look at the penultimate line again. Here the self argument is
placed second to Connection argument. So I reversed their position. But
the problem persists.

Here is a sample:
c=MySQLdb.Conne ct(host='localh ost',user='root ',passwd='',db= 'shop',port=330 6
) Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python24\Li b\site-packages\MySQLd b\__init__.py", line 66, in
Connect
return Connection(*arg s, **kwargs)
File "C:\Python24\Li b\site-packages\MySQLd b\connections.p y", line
134, in __init__MyM
super(self,Conn ection).__init_ _(*args, **kwargs2)
OperationalErro r: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

What is happening?


This is tardy, but if you are still interested -

You are accessing via 'localhost'. Yes ?
If so you need to remove port=3306.

Just leave the [port] parameter unspecified. "localhost" does not use it
and assigning it to 3306 is a conflict.

Test using the [mysql] command line utility by invoking it with the exact
same parameters.
In your case:
msyql -u'root' -p'' -h'localhost'
And make sure that works. If it does your MySQLdb should work.

By the way -
That password_less root logon is distressing if you are running on a server.
With no password on root, one would hope that "localhost" is the only
possible access and *you* are the only one who can touch the machine.

Thomas Bartkus


Jan 3 '06 #2
Hi All,

I sorted out the problem by reinstalling My SQL in another drive.

Regards

Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5075
by: Chris Stromberger | last post by:
When issuing updates in mysql (in the console window), mysql will tell you if any rows matched and how many rows were updated (see below). I know how to get number of rows udpated using MySQLdb, but is there any way to get the number of rows matched? I want to find out, when rows updated = 0, if there were no updates because the row wasn't...
1
6814
by: Sheila King | last post by:
I have searched for an answer to this question on the comp.lang.python archives at Google Groups, and also looked through the (sparse) MySQLdb documentation, and cannot confirm for a FACT what I think I know. Looking for affirmation before I go "assuming" something and getting myself into trouble somewhere along the line... Here is what I...
1
2578
by: Peter Nikolaidis | last post by:
Greetings, I am attempting to get MySQLdb 0.9.2 installed on Mac OS 10.2 with a Fink distribution of Python 2.2.2. I have seen only a few posts on the subject, some of them relate to "conflicting header files," but I don't know what to do about conflicting header files, or where I would find them, and once I found them, which ones to...
1
2994
by: Derek Fountain | last post by:
I was trying to use MySQLdb to connect to a database. All is OK, except I can't figure out how to get the details of an error. Suppose I try to connect to a non existant server, or with the wrong password - how do I get a meaningful error message which I can present to my user?
2
5039
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
21
5237
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All works as expected. But >>> numb=10 >>> cursor.execute("SELECT * FROM mytest where clientID = %d",numb) Traceback (innermost last): File...
2
2525
by: Daniel Baggott | last post by:
Hi, I'm seeking assistance in troubleshooting connecting to MySQL (4.0.20) using Python (2.3.4) and MySQLdb (1.0.0). When I attempt to make a connection, I get the following exception: _mysql_exceptions.InternalError: (-1, 'server not initialized') The database is definitely running as I can connect to it using the mysql client. Also,...
4
3645
by: Mondal | last post by:
Hi, I am using MySQL 5.0 beta and Active Python 2.4. I have the correct version of MySQLdb installed. The problem is that I can't connect to MySQL through the Active Python interactive window. Here is a sample error: >>> c=MySQLdb.Connect(host='localhost',user='root',passwd='',db='shop',port=330­6) Traceback (most recent call last):
1
2944
by: cnivas | last post by:
Hi, I'm doing a small project on Python using MySQL as Database in MAC OS X. I was unable to connect the database. I was downloaded MySQLdb from sourceforge.net and I also modified setup_posix.py. After modified and restart the setup.py I'm getting an error "gcc" cannot find the file. This is the error it was getting when I was reinstalling the...
0
7857
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8162
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6543
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5355
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3797
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3811
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.