Thomas Chalanson
Thomas Chalanson

Reputation: 15

cannot connect to mysql in ubuntu

Hello i have this error when i tried to connect mysql in terminal, what should i do please ?

thomas@thomas-Latitude-E6440:~$ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
thomas@thomas-Latitude-E6440:~$ /etc/init.d/mysql  stop
Stopping mysql (via systemctl): mysql.service.
thomas@thomas-Latitude-E6440:~$ /etc/init.d/mysql  start
Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
 failed!

Upvotes: 0

Views: 508

Answers (1)

Ashish Bairwa
Ashish Bairwa

Reputation: 775

Try to start your mysql service:

sudo systemctl start mysql or sudo systemctl start mysqld

If it fails, try installing mysql-server:

sudo apt-get install mysql-server

If it still fails then to do a complete reinstallation of mysql services:

sudo apt-get remove --purge mysql\*
sudo apt install mysql-server mysql-client
sudo systemctl start mysql

Upvotes: 1

Related Questions