当我安装 mysql-server 时,出现以下错误:
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 : Depends: mysql-server-5.7 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
但是,我可以毫无问题地安装 mysql-client。我尝试了针对相关问题给出的所有解决方案,但都没有用。我尝试过的相关问题是:
以下问题也与我的问题不符:ubuntu16.04安装Mysql-server出错
有人能帮我解决这个问题吗?提前谢谢了。
答案1
最后我找到了一个解决方案地点。
如其他答案所述,卸载所有现有的 mysql 模块。要获取已安装的 mysql 模块列表,请使用以下命令:
dpkg -l | grep mysql
mysql-apt-config_0.7.3-1_all.deb
从下载MySQL 网站。
使用以下命令安装该包:
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