Common reasons for this error ... Is mysql server running?
mysqladmin -u root -p statusIf not, consult the log to find out why.
If so, can you connect as 127.0.0.1?
If that works, what's the socket setting in my.cnf, and where's the sock file (usually /data/mysql_datadir/mysql.sock or /tmp/mysql.sock)
A symlink might fix it, and/or you may need to ...
sudo chmod -R 755 /var/lib/mysql/Does the startup scipt specify socket=...? If so, it may not match my.cnf. Correct one or the oither.
If you can't find the sock file, does this find it?
sudo find / -type sIf so, edit my.cnf accordingly.
Last updated 11 Apr 2020