Ubuntu 17.04 - 无法安装mysql-server-5.6

时间:2017-11-20 07:48:50

标签: ubuntu package apt

我到处寻找这个,无法让它发挥作用。 跑步时:

sudo apt-get install mysql-server-5.6

我得到了这个结果:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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-5.6 : Depends: initscripts but it is not installable
                    Depends: mysql-client-5.6 (>= 5.6.16-1~exp1) but it is not going to be installed
                    Depends: mysql-server-core-5.6 (= 5.6.16-1~exp1) but it is not going to be installed
                    Depends: sysv-rc (>= 2.88dsf-24) but it is not installable or
                             file-rc (>= 0.8.16) but it is not installable
E: Unable to correct problems, you have held broken packages.

我也尝试过:

sudo aptitude install mysql-server

试图解决它:

     Keep the following packages at their current version:
1)     mysql-client-5.6 [Not Installed]                   
2)     mysql-client-core-5.6 [Not Installed]              
3)     mysql-server-5.6 [Not Installed]                   
4)     mysql-server-core-5.6 [Not Installed]              

但这也不起作用。

dpkg --get-selections | grep hold

在dpkg命令上面命令没有任何东西。 此外,任何其他升级/更新或删除/清除任何mysql实例都没有帮助。 谢谢!

修改-1 在清除mysql *并重新安装aptitude之后,我摆脱了一些依赖关系。持久性依赖项是 initscripts sysv-rc file-rc 。所以还在这里挣扎。

1 个答案:

答案 0 :(得分:1)

Ubuntu 17.04仅提供MySQL 5.7的软件包,它与针对较旧的MySQL版本编写的代码存在一系列向后兼容性问题。

Oracle维护了MySQL 5.6的官方APT存储库列表,但这些存储库尚不支持Ubuntu 17.04(截至本文撰写时)。这是以前版本的ubuntu中一直存在的问题。

要解决此问题,请先删除/卸载所有现有的mysql模块。要获取已安装的mysql模块列表,请使用以下命令:

dpkg -l | grep mysql

Mysql Website下载apt_config-debian包(mysql-apt-config_0.7.3-1_all.deb)并使用以下命令安装:

sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb

使用此内容

创建新文件/etc/apt/preferences.d/mysql
Package: *
Pin: origin "repo.mysql.com"
Pin-Priority: 999

运行以下命令以更新缓存

sudo apt update

运行以下命令安装MySQL

sudo apt install mysql-client mysql-server libmysqlclient-dev

你应该得到5.6版本。

此解决方案已被更多地讨论here,如果您想要更多详细信息,或者遇到一些问题。