How Do You Troubleshoot the Error “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)”?

Problem scenario
You install mysql on a RedHat (RHEL) Linux server in AWS.  You run this command: mysql -u root -p

But you get this message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

How can you get around this problem and get to a SQL interface?

Solution
sudo systemctl start mariadb.service

Leave a comment

Your email address will not be published. Required fields are marked *