having problem connecting to my sql DB
i receive this message in connecting, can you guide me through pls
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
1 Reply
There are a couple of reasons why MySQL would show a "can't connect through socket" message.
The first is that MySQL is not started. Try running service mysql start
(or the appropriate start command for your distro) and connecting again. You can also try restarting MySQL.
If MySQL is running and you are still receiving a "can't connect through socket" message, you may need to change some configurations in your /etc/my.cnf
file. You can find all of the socket files on your Linode with the command sudo find / -type s
; find the filepath for your MySQL socket file. You can then edit or add that path in your /etc/my.cnf
file with the syntax socket=/file/path/goes/here
.
Additionally, I recommend this StackOverflow post for more detailed explanations of the above solutions as well as solutions for less common causes of the socket error you're experiencing.