'django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)")

i was trying to connect to mySQL DB but i got this error although the server is running as shown: enter image description here

and here's my connection data:

DB_HOST='127.0.0.1'

DB_NAME='trustline'

DB_USER='root'

DB_PASSWORD=''

DB_PORT=3306

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql',

        'NAME': config('DB_NAME'),
        'USER': config('DB_USER'),
        'PASSWORD': config('DB_PASSWORD'),
        'HOST': config('DB_HOST'),
        'PORT': '3306',
        'OPTIONS': {
            'sql_mode': 'STRICT_TRANS_TABLES',
            'charset': 'utf8mb4'
        },
    }
}

what should be done?



Solution 1:[1]

I think angular service works are a great choice for this and bring other performance boosts. It provides robust cache info strategies for various types of requests, one of which is assets https://angular.io/guide/service-worker-intro

If you don’t want to go the service worker route I recommend looking into an Angular HttpInterceptors (https://angular.io/api/common/http/HttpInterceptor) and how you could implement a cache at this point responding to requests without it leaving your app

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bjlasc01