centos6.9安装mariadb失败及解决办法

yum install MariaDB-server MariaDB-client

提示:mysql-server-5.1.73-8.el6_8.x86_64 was supposed to be removed but is not!

因为安装操作系统的时候,mysql也一块安装了,但安装MariaDB并不能卸载此前安装的mysql,导致MariaDB安装失败。

1、首先查找出安装的mysql包

    [root@centos6 ~]# rpm -qa | grep -i '^mysql-'
    mysql-server-5.1.73-8.el6_8.x86_64

2、如果mysql在开启,首先关闭

    [root@centos6 ~]# /etc/init.d/mysqld stop
    Stopping mysqld:                                           [  OK  ]

3、卸载安装的mysql包

    [root@centos6 ~]# rpm --nodeps -ev mysql-server-5.1.73-8.el6_8.x86_64

4、查看是否卸载了mysql

    [root@centos6 ~]# rpm -qa | grep -i '^mysql-'

    没有显示即没有和mysql相关的包,已经卸载。

5、重新执行MariaDB安装

    yum install MariaDB-server MariaDB-client

6、查看安装MariaDB生成的文件

    [root@centos6 ~]# rpm -ql MariaDB-server

    /etc/init.d/mysql
    /etc/logrotate.d/mysql
    /etc/my.cnf.d
    /etc/my.cnf.d/server.cnf
    ....

7、启动服务

    [root@centos6 ~]# /etc/init.d/mysql start
    Starting MySQL.180120 16:22:20 mysqld_safe Logging to '/var/lib/mysql/centos6_103.sunan.err'.
    180120 16:22:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    ...                                                        [  OK  ]
    [root@centos6 ~]# ss -ntl
    State      Recv-Q Send-Q                  Local Address:Port                    Peer Address:Port 
    LISTEN     0      50                                  *:3306                               *:*     
    LISTEN     0      128                                 *:57007                              *:*     
    LISTEN     0      128                                :::111                               :::*

    看到3306端口已经开启

8、查看安装的版本

    [root@centos6 ~]# mysql --version  
    mysql  Ver 15.1 Distrib 5.5.59-MariaDB, for Linux (x86_64) using readline 5.1

 

水滴石穿,绳锯木断。

你可能感兴趣的:(学习笔记)