I have checked the answers to these questions and many others but my problem isn't still solved yet:
- django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)"
- mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (111 Connection refused)
I got a new system (Windows,same as the old one) and installed Ubuntu 22.04 and install Django and other dependencies, including pipenv
to manage the packages.
In my old system, the project was in a Dropbox folder and I have navigated to it in the new system, but when I run python manage.py runserver
I get
...lib/python3.10/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1:3306' (111)")
My database setting is also okay and MySQL80 is running when I checked Windows Services
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'my_db',
'USER': 'root',
'PASSWORD': 'my_password',
'HOST': '127.0.0.1',
'PORT': '3306',
}
}
Meanwhile, the old system works just fine.