Search code examples
mysqlsocketsubuntu-14.04lamp

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in ubuntu 14.04


I have installed LAMP on my Ubuntu machine.

Where Apache2 and PHP5 have been installed properly as when I run apache2 -v and php5 -v I am getting their installed versions.

But I am not sure how do I check If My-SQL is properly installed or not.

Because when I run mysql -u root -p command, I am getting the below error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Please help!


Solution

  • you could try starting your mysql first

    > ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
    > 
    > service mysql start or service mysql start