473,729 Members | 2,141 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 4509
"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
5086
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 found (rows matched will = 0) or because the update would not have changed any data (rows matched =...
1
6826
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 *think* I know...let me know if I'm wrong, for crying out loud!!!
1
2584
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 remove. I have compiled MySQL 4.1 and installed into /usr/local/mysql, but since have moved to a Fink...
1
3007
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
5051
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
5252
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 "<stdin>", line 1, in ?
2
2530
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, when I attempt to connect to MySQL from within Python, I don't see any messages in the MySQL logs...
4
3651
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
2949
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 setup.py "Administrator:MySQL-python-1.2.2 administrator$ sudo python setup.py install running...
0
8764
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9210
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8159
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6026
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4534
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4798
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.