mysql-server无法在linux

时间:2017-11-07 23:20:37

标签: mysql linux install reinstall

我删除了当前的mysql:

apt-get remove --purge mysql-server mysql-client mysql-common
apt-get remove --purge mysql-client-core-5.5
apt-get autoremove
apt-get autoclean
rm -rf /var/lib/mysql

而且当我想重新安装时,我遇到了一些问题:

apt-get install mysql-server 

//输出

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.**

再次

apt-get install mysql-server-5.5 

//输出

以下信息可能有助于解决问题:

The following packages have unmet dependencies:
mysql-server-5.5 : PreDepends: mysql-common (>= 5.5.47-0+deb7u1) but it is not going to be installed
Depends: mysql-client-5.5 (>= 5.5.47-0+deb7u1) but it is not going to be installed
Recommends: mailx
E: Unable to correct problems, you have held broken packages.

我已安装多次 mysql-common mysql-clint-5.5

可能有什么问题?

2 个答案:

答案 0 :(得分:0)

我在6小时后解决了这个问题:) 主要问题是版本号。在取消后,你应该这样写:

安装mysql-server:

首先安装mysql-server-5.5

并安装mysql-server-5.5:

安装mysql-common apt-get install mysql-common=5.5.47-0+deb7u1

安装mysql-client-5.5 apt-get install mysql-client=5.5.47-0+deb7u1

安装后:   安装mysql-server-5.5 apt-get install mysql-server-5.5

最后:  安装mysql-server mysql-client apt-get install mysql-server mysql-client

答案 1 :(得分:0)

我编写了这个脚本来解决我的 ubuntu 20.04 中的此类问题,请参阅我的评论中的详细信息:

#!/bin/bash

#Force install of missing deps
sudo apt-get -f install -o Dpkg::Options::="--force-overwrite"

#Remove the installed Apache 2
sudo apt-get purge apache2\*

#And followed by:
sudo apt-get purge mysql\*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo dpkg -l | grep -i mysql
sudo apt-get clean
sudo apt-get aut
sudo updatedb

#Reinstall full webstack if you want to.
sudo apt-get install lamp-server^