I'm Trying to connect to Mysql server from python. and i'm getting the following error: Traceback (most recent call last): File "./db_connection.py", line 2, in <module> Con = MySQLdb.Connect(host="127.0.0.1",port= 3360, user="username", passwd="password", db="entries") File "/usr/lib64/python2.7/site-packages/MySQLdb/__init__.py", line 85, in Connect return Connection(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 204, in __init__ super(Connection, self).__init__(*args, **kwargs2) _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)") I checked and my port is 0 : mysql> show variables like 'port'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 0 | +---------------+-------+ 1 row in set (0.01 sec) and skip_networking=ON: mysql> SHOW VARIABLES LIKE 'skip_networking'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | skip_networking | ON | +-----------------+-------+ 1 row in set (0.00 sec) file my.cnf looks like that: [mysqld] skip-grant-tables datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid I tried to put skip-networking = Off and port=3360 and then restart mysql service and it didn't work- skip_networking is still on. Any suggestions on how to connect MySQL DB with python? Thanks! Continue reading...