Can't connect to MySQL server


I can't run python migrations from bach console. whatever I try it always raises this host issue:

File "/home/XYZ/.virtualenvs/msgl/lib/python3.7/site-packages/django/db/backends/mysql/", line 227, in get_new_connection return Database.connect(conn_params) File "/home/XYZ/.virtualenvs/msgl/lib/python3.7/site-packages/MySQLdb/", line 85, in Connect return Connection(*args, kwargs) File "/home/XYZ/.virtualenvs/msgl/lib/python3.7/site-packages/MySQLdb/", line 204, in init super(Connection, self).init(args, *kwargs2) django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on '' (110)")

Thanks for your support in advance. Sezen E.

Are you sure you're using the correct hostname and username from your Databases tab and are you sure you have the correct Django settings as described here:

hi , I think so, This is what I have in my databases tab (I just replaced my user name with XYZ):

MySQL settings Connecting:

Use these settings in your web applications. Database host address:

Should I use something else?

thanks Sezen

No, but make sure that the other parts of the DATABASES settings entry are also correct.

thanks for the response Glenn.

Here is what I have in database settings, which looks good to me:


'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'xyz$abcdb',


Why would it complain that it cannot connect to the database: 2003, "Can't connect to MySQL server on '' (110)")

Is it physical access issue, I mean in networking layer or is it credentials issue preventing django to login to the database?

I can login to the database through the console successfully:

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | xyz$default | | xyz$abcdb | +--------------------+ 3 rows in set (1.97 sec) mysql>

Thanks again in advance for your support.

Your port is wrong. Either use the correct default of 3306, or just leave it out entirely.

thanks glenn good catch, I had overlooked the port when I changed it from postgreSQL to mySQL. It works well after updating the port.