阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Ubuntu重新安装MySQL错误解决

107次阅读
没有评论

共计 1128 个字符,预计需要花费 3 分钟才能阅读完成。

新搭建的服务器,先在 Ubuntu 上安装 mariadb,后来由于很多权限问题,决定安装 MySQL,由于在卸载过程中未卸载干净,导致 MySQL 重新安装过程中出现了很多问题。

Reading package lists…Done
Building dependency tree
Reading state information … Done
mysql-server is already the newest version(5.7.21-0ubuntu0.16.04.1).
You might want to run ‘apt-get -f install’ to correct these:
The following packages have unmet dependencies:
mysql-server: depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies.Try ‘apt-get -f install’ with no packages(or specify a solution).

通过阅读错误信息可知,主要是因为依赖关系出现问题,主要思路是重建依赖关系,然后干净卸载,最后重装。

首先,更新系统

sudo apt-get update

然后,修复安装错误,会提示输入 mysql 用户名密码

sudo apt-get –fix-broken install

然后,检索 mysql 安装包,并删除检索出的依赖包,然后是删除 /var/lib/mysql, 最后重装 mysql。

下面我把检索到的解决方法展示给大家:

We excute the following commands to solve the above problem:
    1.Get the list of MySQL packages installed on the system by executing the command sudo dpkg -l grep mysql
    2.Remove the packages shown above by executing the command
      sudo apt-get –purge autoremove <packages from the step 1>
    3. Delete /var/lib/mysql
    4.Try to install mysql again.It should solve your problem.

第二步中的 packages 如下图所示:

Ubuntu 重新安装 MySQL 错误解决

最后就是更新系统并重装 mysql

sudo apt-get update

sudo apt-get install mysql-server mysql-client

总结:

整体思路还是重建依赖关系,干净卸载,更新安装。希望对遇到相同问题不知所措的小伙伴有所启发、帮助。谢谢。

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计1128字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中