Skip to Content

Can’t connect to local MySQL server through socket /tmp/mysql.sock

Failed to connect to database: Error: Can’t connect to local MySQL server through socket ’/tmp/mysql.sock’ (2). . An error occurred. Please contact administrator..


Can’t connect to local MySQL server through socket ’3306 ’ in ezsh.log 

 
Edit the file "/usr/local/etc/ezlogin/ez.conf" and correct the variable

db_port <path to the mysql socket file found using the command below>

mysql -e "show variables like ’socket’;"

Usually it would be /var/lib/mysql/mysql.sock but varies from server to server.

The command above would show the path to the mysql socket file that is current in use, else you would need to setup them in the mysql configuration file usually found in /etc/my.cnf.

You would need to make sure that the mysql sock does exist in the path specified in /usr/local/etc/ezlogin/ez.conf