Solution :
I know such errors are very annoying. I had faced this error earlier and was able to fix it.
The below command helped me.
sudo /usr/local/mysql/support-files/mysql.server start
If above command does not work for you then you need to make sure that the mysqld is running and then you can try connecting it again.
If still not working then you can try below process.
At your terminal you need to run below command
mysql_config –socket
Above command will provide you with your path to the sock file. You need to take that path and then you can use it in your DATABASES HOST paramater.
You need to do below in your DATABASES HOST parameter:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test',
'USER': 'test',
'PASSWORD': 'test',
'HOST': '/Applications/MAMP/tmp/mysql/mysql.sock',
'PORT': '',
},
}
It will surely fix the problem.