django.db.utils.OperationalError: (2002, 'Can\'t connect to local MySQL server through socket \'/cloudsql/instance:us-central1:project_name\' (2 "No such file or directory")')

350 views
Skip to first unread message

Solomon Mbak

unread,
Aug 9, 2019, 11:37:44 PM8/9/19
to Django users
Hi.

For two days I have been stuck on deploying my Django app on Google App Engine. I cloned the project from my Github account. I have installed the requirements also.

The database in-use is a mysql database 

I get an error that says "django.db.utils.OperationalError: (2002, 'Can\'t connect to local MySQL server through socket \'/cloudsql/instance:us-central1:project_name\' (2 "No such file or directory")')".

I have tried all I can and haven't really found any solutions online.
My database connection looks like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '/cloudsql/instance:us-central1:project',
'USER': 'root',
'PASSWORD': 'password',
'NAME': 'db_name',
}
}

Budi Hermansyah

unread,
Aug 10, 2019, 4:14:07 PM8/10/19
to django...@googlegroups.com
please search for how to access your sql on gcp with ssh and with IP addr... then 
repace the following setting using that IP...
from:

'HOST': '/cloudsql/instance:us-central1:project',
to
'HOST': 'xx.xx.xx.xx',


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2e58e307-8490-478f-a8cf-4cf640fde5bc%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages