你好,当我试图在终端中连接mysql时出现了这个错误,我该怎么办?
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!
尝试启动您的mysql服务:
sudo systemctl start mysql or sudo systemctl start mysqld
如果失败,请尝试安装mysql-server:
sudo apt-get install mysql-server
如果它仍然失败,那么就重新安装mysql服务:
sudo apt-get remove --purge mysql*
sudo apt install mysql-server mysql-client
sudo systemctl start mysql