On a new Linux installation I was getting an error when logging into MySQL using
mysql -u Username -p
The error was shown as:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
A silly error to encounter. I found that MySQL server was not installed.
Having rebuilt the computer with a replacement hard drive numerous packages had been installed.
Installing PHPMyAdmin there were errors connecting to MySQL leading to the discovery that I was yet to install MySQL.
I installed MySQL using the command:
apt-get install mysql-server
With MySQL installed PHPMyAdmin worked and all was well. The Can’t connect to MySQL server error was resolved.