#2002 - 无法通过socket' /var/run/mysqld/mysqld.sock'

时间:2016-05-21 16:29:15

标签: mysql sockets

我试图在Ubuntu 14.04计算机上安装一些东西,运行sudo apt-get update,然后运行sudo apt-get upgrade,它显然对我的MySQL服务器做了一些事情。

现在我无法启动它。我收到这个错误:

#2002 - Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) — 
The server is not responding (or the local server's socket is not correctly configured).

我不确定服务器是否已安装。当我尝试重新启动或启动服务时,它总是返回"作业失败!"。

我已经清除了一切:

$ sudo apt-get remove --purge mysql\*

然后尝试用

重新安装它
$ sudo apt-get install mysql-server mysql-client

但它基本上以此结束,我回到原点。

Preparing to unpack .../mysql-server-5.5_5.5.35+dfsg-1ubuntu1_amd64.deb ...
Aborting downgrade from (at least) 5.6 to 5.5.
If are sure you want to downgrade to 5.5, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.35+dfsg-1ubuntu1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1


Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.5_5.5.35+dfsg-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试安装mysql-server-5.6 mysql-client-5.6 不会有任何帮助:

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up mysql-common-5.6 (5.6.16-1~exp1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 mysql-server-5.6
E: Sub-process /usr/bin/dpkg returned an error code (1)

我在这里发现了很多帖子,并提供了相同的错误消息,并尝试了所有提出的解决方案,但没有任何效果。救命啊!


解决

虽然,也许不是以最好的方式。 这就是我的所作所为:

$ sudo -i
# sudo apt-get remove --purge mysql\* 
# cp -R /var/lib/mysql /home/user/backup
# sudo rm -rf /var/lib/mysql/
# sudo rm -rf /etc/mysql
# sudo apt-get autoremove
# sudo apt-get autoclean
# sudo apt-get install mysql-server php5-mysql

然后我不得不恢复我备份的数据库,最后我开始运行它。我为此感到很生气。

0 个答案:

没有答案