問題描述
我在 LAMPwiki/List_of_Ubuntu_releases#Ubuntu_12.04_LTS_.28Precise_Pangolin.29">Ubuntu 12.04 LTS (Precise Pangolin) 然后在 phpMyAdmin.我忘記了密碼,現(xiàn)在無法登錄.當我嘗試通過終端更改密碼時,我得到:
I installed LAMP on Ubuntu 12.04 LTS (Precise Pangolin) and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to change password through terminal I get:
ERROR 2002 (HY000): 無法通過套接字連接到本地 MySQL 服務器'/var/run/mysqld/mysqld.sock'(2)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
我該如何解決這個問題?我無法打開 LAMP、卸載或重新安裝.
How can I fix this? I am unable to open LAMP, uninstall it or reinstall it.
推薦答案
我曾經(jīng)遇到過這個問題,通過安裝mysql-server
解決了,所以請確認你已經(jīng)安裝了mysql-server
,而不是 mysql-client
或其他東西.
I once had this problem and solved it by installing mysql-server
, so make sure that you have installed the mysql-server
, not the mysql-client
or something else.
那個錯誤意味著文件/var/run/mysqld/mysqld.sock
不存在,如果你沒有安裝mysql-server
,那么文件不會存在.所以在這種情況下,用
That error means the file /var/run/mysqld/mysqld.sock
doesn't exists, if you didn't install mysql-server
, then the file would not exist. So in that case, install it with
sudo apt-get install mysql-server
但是如果mysql-server
已經(jīng)安裝并且正在運行,那么你需要檢查配置文件.
But if the mysql-server
is already installed and is running, then you need to check the config files.
配置文件是:
/etc/my.cnf
/etc/mysql/my.cnf
/var/lib/mysql/my.cnf
在/etc/my.cnf
中,socket文件配置可能是/tmp/mysql.sock
和/etc/mysql/my.cnf
套接字文件配置可能是 /var/run/mysqld/mysqld.sock
.所以,刪除或重命名/etc/mysql/my.cnf
,讓mysql使用/etc/my.cnf
,那么問題就可以解決了.
In /etc/my.cnf
, the socket file config may be /tmp/mysql.sock
and in /etc/mysql/my.cnf
the socket file config may be /var/run/mysqld/mysqld.sock
. So, remove or rename /etc/mysql/my.cnf
, let mysql use /etc/my.cnf
, then the problem may solved.
這篇關于ERROR 2002 (HY000): 無法通過 socket '/var/run/mysqld/mysqld.sock' 連接到本地 MySQL 服務器 (2)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!