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 卸载并没有将所有依赖项全部卸载导致的问题。
卸载
- yum remove mariadb
卸载mariadb,同时也卸载了mariadb-server - yum list installed | grep mariadb
发现在安装mariadb时作为依赖项的mariadb-libs没有被删除。 - yum remove mariadb-libs
将其卸载 - rm -rf /etc/my.cnf
- rm -rf $(find / -name mysql)
删除所有包含mysql的文件(夹) - reboot
安装
- yum install mariadb
- yum install mariadb-server
按mariadb并不同时安装mariadb-server - systemctl start mariadb
- systemctl enable mariadb
- mysql_secure_installation
配置mariadb。 - mysql -uroot -p
使用前面设置的root密码登录进mariadb - update mysql.user set host=’%’ where user=‘root’ and host=‘localhost’;
flush privileges;
设置mysql可用远程登录。