当我试图通过以下方式安装mysql时:
sudo apt-get install mysql-server
在配置phpmyadmin时出现以下错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
我试过了
service mysql status
看看我的mysql是怎么回事,我得到了这个:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: failed (Result: exit-code) since Tue 2018-05-15 10:00:29 +0430; 25min
Process: 1012 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
مئی 15 10:00:29 Thispc-Lenovo-G50-80 systemd[1]: mysql.service: Service hold-off t
مئی 15 10:00:29 Thispc-Lenovo-G50-80 systemd[1]: mysql.service: Scheduled restart `enter code here`
مئی 15 10:00:29 Thispc-Lenovo-G50-80 systemd[1]: Stopped MySQL Community Server.
مئی 15 10:00:29 Thispc-Lenovo-G50-80 systemd[1]: mysql.service: Start request repe
مئی 15 10:00:29 Thispc-Lenovo-G50-80 systemd[1]: mysql.service: Failed with result
مئی 15 10:00:29 Thispc-Lenovo-G50-80 systemd[1]: Failed to start MySQL Community S
我看到它有错误,但是当我尝试重新启动mysql时
sudo service mysql restart
我得到这个错误:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
我搜索了一下,发现了这个命令:
su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &"
它要求输入密码,我输入了我的根密码,得到这个错误:
su: Authentication failure error
然后我试着改变我的用户名和密码
mysql -h localhost -u root -p
我又得到了:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' error
我也试过了
sudo apt-get autoremove
和
sudo apt-get autoclean
也有同样的错误
正如你所看到的,我很混乱,我已经努力使它工作了将近两天。如果有人能帮助我,我将不胜荣幸。
1条答案
按热度按时间inkz8wg91#
这个问题以前发生在我身上,我按照这篇文章解决了它。
我所做的就是杀死
mysql
重新启动前的进程。