CentOS7完全卸载MariaDB

问题

在CentOS7中安装了MariaDB和MariaDB-server,卸载了以后重新安装,然后使用Systemctl start mariadb,出现了“Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.”的错误提示,仔细研究了一下,发现在使用 yum remove mariadb 卸载并没有将所有依赖项全部卸载导致的问题。

卸载

  1. yum remove mariadb
    卸载mariadb,同时也卸载了mariadb-server
  2. yum list installed | grep mariadb
    发现在安装mariadb时作为依赖项的mariadb-libs没有被删除。
  3. yum remove mariadb-libs
    将其卸载
  4. rm -rf /etc/my.cnf
  5. rm -rf $(find / -name mysql)
    删除所有包含mysql的文件(夹)
  6. reboot

安装

  1. yum install mariadb
  2. yum install mariadb-server
    按mariadb并不同时安装mariadb-server
  3. systemctl start mariadb
  4. systemctl enable mariadb
  5. mysql_secure_installation
    配置mariadb。
  6. mysql -uroot -p
    使用前面设置的root密码登录进mariadb
  7. update mysql.user set host=’%’ where user=‘root’ and host=‘localhost’;
    flush privileges;
    设置mysql可用远程登录。
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐