前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ubuntu重新安装MySQL错误解决

Ubuntu重新安装MySQL错误解决

作者头像
星哥玩云
发布2022-08-16 15:34:23
1.6K0
发布2022-08-16 15:34:23
举报
文章被收录于专栏:开源部署开源部署

新搭建的服务器,先在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如下图所示:

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

sudo apt-get update

sudo apt-get install mysql-server mysql-client

总结:

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
数据库
云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档