Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ – Sometimes you get this error while starting the mysql server. There can be different reason for this. Here in this solution we are going to tell how you can fix the above error.
Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’
1 . Go to folder – /etc/mysql/ open my.cnf
2. Now go to client [client] section and add the following
If [Client] Section is not available-
Can’t connect to local MySQL server through socket :
[client] socket=/var/lib/mysql/mysql.sock |
If [Client] Section is available-
If client section is already available in my.cnf file then only add the below code in [client] section as below –
Can’t connect to local MySQL server through socket:
socket=/var/lib/mysql/mysql.sock |
After Adding the above it will fix your issue.