我们目前尝试在 Ubuntu 16.04.6 LTS Box 上重新安装 MySQL 5.7
但安装失败并出现以下错误:
#sudo apt-get install mysql-server mysql-client --fix-broken --fix-missing
[...]
dpkg: error processing package mysql-server (--configure):
dependency problems — leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.27) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
我们已经清除了之前的安装。
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
似乎运行正常,没有错误消息。之后我们检查:
#dpkg-query -l mysql-server
dpkg-query: no packages found matching mysql-server
此外,我们还手动删除了剩余的文件夹,以确保没有任何残留文件会干扰新安装。
rm -rf /etc/mysql /var/lib/mysql
但是,每次尝试安装仍然会失败并出现该错误。有人知道我们可以做些什么来解决这种情况吗?
答案1
我会首先尝试删除 MySQL:
sudo apt purge mysql-server mysql-client mysql-common
sudo apt autoremove
sudo mv -iv /var/lib/mysql /var/tmp/mysql-backup
sudo rm -rf /var/lib/mysql*
此后,我将再次安装 MySQL:
sudo apt update
sudo apt install mysql-server
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
尝试一下,然后告诉我是否有效