无法安装 mysql-server-5.5/以下软件包具有未满足的依赖关系

无法安装 mysql-server-5.5/以下软件包具有未满足的依赖关系

我使用的是 Ubuntu 14.04。

我尝试mysql使用以下命令输入:

mysql -u root -p

我收到以下消息:

该程序mysql可以在以下软件包中找到:

  • mysql-client-core-5.5
  • mariadb-client-core-5.5
  • mysql-client-core-5.6
  • percona-xtrabd-cluster-client-5.5

然后我输入:

sudo apt-get install mysql-client-core-5.6

安装后,我尝试mysql使用以下命令再次连接:

mysql -u root -p

然后我收到错误消息:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

网上查了一下,发现需要安装mysqlserver,于是我写了以下命令

sudo apt-get install mysql-server

然后我收到消息;

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
 E: Unable to correct problems, you have held broken packages.

在过去的一个小时里,我一直在网上寻找解决方案,但是其他人也有类似的错误,但由于升级而出现了该错误mysql,因此该解决方案对我来说无效。

答案1

你的问题的原因可能是你试图混合不同版本的mysql。

您已经mysql-client-core-5.6并且正在尝试安装mysql-server-5.5.

那么你想要5.5还是5.6呢?

删除mysql-client-core-5.6(以及可能安装的任何其他 mysql-5.6 软件包)并安装mysql-client-core-5.5。然后你应该能够安装mysql-server(这取决于mysql-server-5.5

或者

尝试安装mysql-server-5.6而不是安装mysql-server

答案2

你需要安装

mysql 服务器和 mysql 共享

套餐

答案3

这是另一个 unix.stackexchange 答案解决了我的问题:

sudo aptitude install mysql-server

Aptitude 可能会告诉您必须卸载 mysql-server,但是您应该能够重新安装它以修复未满足的依赖关系。

但是,我不确定安装是否是您的问题。ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)可能意味着 mysql 没有运行。因此,在卸载/安装任何内容之前,请尝试:

/etc/init.d/mysql start

祝你好运!

答案4

试试这个:

mkdir /var/run/mysqld

touch /var/run/mysqld/mysqld.sock

chown -R mysql /var/run/mysqld

/etc/init.d/mysql restart

相关内容