云服务器上(centOS 7)搭建mysql
安装mysql不能启动,卸载。
1.执行yum命令,删除MySQL的lib库,服务文件
# yum remove mysql mysql-server mysql-libs mysql-server
2.执行find命令,查找MySQL的残留文件
# find / -name mysql
3.如果存在残留文件,将其删除。
# rm -rf *mysql*
先删除系统中已存在的MySQL安装包
1.查找是否有mysql安装包
# rpm -qa | grep -i mysql
2.如果有,则删除安装包
# yum -y remove mysql-libs*
卸载自带MariaDB:
列出Maria所有包:
# rpm -qa | grep mariadb
2。逐个删除对应文件
# rpm -e --nodeps mariadb-server-5.5.60-1.el7_5.x86_64
3.再次列出Maria所有包:# rpm -qa | grep mariadb ,确认卸载干净。
重新安装MySQL安装rpm包:
[root@master ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-release-el7-5 ################################# [100%]
这时查看当前可用的mysql安装资源:
[root@master ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 14
mysql-tools-community/x86_64 MySQL Tools Community 17
mysql56-community/x86_64 MySQL 5.6 Community Server
用yum方式安装了MySQL5.6-community版本:
[root@master~]# yum -y install mysql-community-server
安装成功后,将其加入开机启动:
[root@master ~]# systemctl enable mysqld
启动MySQL进程:
[root@master~]# systemctl start mysqld