0

i have a local mysql server running on localhost, Windows 7

C:\web>mysqld --console
[...]
130428 19:12:37 [Note] mysqld: ready for connections.
Version: '5.5.31-log'  socket: ''  port: 3306  MySQL Community Server (GPL)

if i try to connect with mysql, i've got no issues (root has no password)

C:\Users\Alle>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.31-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use information_schema
Database changed
mysql>

But when i try to connect to mysql via MySQL-Python 1.2.4 this fails:

C:\Users\Alle>python
Python 2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.connect('localhost', 'root', '', 'information_schema')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")

here's my conf

I'm stuck with that, i don't know what to do.. what i can do to debug the issue and get mysql-python working? I need this for Django, so i can't switch connector.

1 Answer 1

3

try 127.0.0.1 instead chances are localhost is not properly mapped, or maybe you also need to include the port in your connect?

Sign up to request clarification or add additional context in comments.

4 Comments

tried with port 3306 and 127.0.0.1, didn't work i'm out of ideas
install wamp or xamp and have them run your localhost server should work for a quick fix ... no idea what the actual problem is
don't ask me why, but a windows restart solved the issue. i'm planning to delete the question, or answer to myself..
but you're right, with localhost it doesn't work now, so i need to set 127.0.0.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.