I have installed MySQL for Python . Now I try to connect to the MySQL Community Server on my local machine, using this code:

DATABASES = {
        'default': {                                           
            'NAME': "food",
            'ENGINE': 'django.db.backends.mysql',
            'HOST': 'localhost',
            'USER': 'root',
            'PASSWORD': 'groot',

This code fails with this error:

... connection = Database.connect(**conn_params) File "C:\Users\mona\Downloads\food-ordering-system-master\food-ordering-system-master\food-ordering-system\env\lib\site-packages\MySQLdb_init_.py", line 84, in Connect return Connection(*args, **kwargs) File "C:\Users\mona\Downloads\food-ordering-system-master\food-ordering-system-master\food-ordering-system\env\lib\site-packages\MySQLdb\connections.py", line 179, in init super(Connection, self).init(*args, **kwargs2) django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'localhost' (10061)")

Back to Top