TSL/SSL error: Certificate verification failure

I have a database that upload on Google Cloud Platform using MySQL version 8.0

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'xx',
        'HOST': 'xx',
        'PASSWORD': 'xx',
        'NAME': 'xx',
        'PORT': ' ',
    }
}

I am trying to connect with it using Django but keep getting this Error
RuntimeWarning: Got an error checking a consistent migration history performed for database connection ‘default’: (2026, ‘TLS/SSL error: Certificate verification failure: The certificate is NOT trusted.’)
I’ve tried a serveral way to add OPTION to disable SSL but none of it works. Can someone help me out a bit. Thank you very much!

I am getting the same error when trying to connect to my AWS RDS database when running django locally. I can connect through the command line and through MYSQL workbench but then when running django get django.db.utils.OperationalError: (2026, ‘TLS/SSL error: Certificate verification failure: The certificate is NOT trusted.’) error.

Yes, this is the same problem for me also, hope someone can help us. I try most of the way on the internet but still no answer.

Have you tried explicitly writing down the port (3306)?

Furthermore, Google Cloud SQL requires SSL connections for security reasons. To resolve the certificate verification error, you must correctly configure the SSL parameters in your Django configuration.

If you don’t want to use SSL, you might want to use a workaround, such as Google’s Cloud SQL Proxy. This tool handles SSL connections automatically and simplifies configuration.

You can find more information here: Cloud SQL Proxy