CentOS 6.5 yum安装mysql5.6或其他版本【默认yum只能安装mysql 5.1】 by jason
by jason
【备份配置文件】
CentOS 6.5 默认yum只能安装mysql 5.1 安装前要检查机器原来是否安装过mysql,如有安装需要先进行数据备份、清理。 [root@snails ~]# yum list installed | grep mysql [root@snails ~]# ps -ef|grep mysql [root@snails ~]# service mysqld stop [root@snails ~]# rpm -e mysql-libs --nodeps [root@snails ~]# yum -y remove mysql mysql-* 设置安装源 [root@snails ~]# wget http://repo.mysql.com/mysql57-community-release-el6-8.noarch.rpm [root@snails ~]# rpm -ivh mysql57-community-release-el6-8.noarch.rpm [root@snails ~]# ls -1 /etc/yum.repos.d/mysql-community* [root@snails ~]# yum repolist all | grep mysql [root@snails ~]# vi /etc/yum.repos.d/mysql-community.repo ### 将[mysql56-community]的enabled设置为1,[mysql57-community]的enabled设置为0 ### [root@snails ~]# yum repolist enabled | grep mysql mysql-connectors-community MySQL Connectors Community 21 mysql-tools-community MySQL Tools Community 37 mysql56-community MySQL 5.6 Community Server 265 注意: 如果不使用5.7 或者其他任何版本,只能有一个是 enabled=1的,其他的都得enabled=0。 安装MySQL [root@snails ~]# yum -y install mysql-server mysql
安装完之后直接启动
将之前备份的my.conf配置文件放到/etc/my.conf
service mysqld start
之后分配用户名密码:
mysql> grant all privileges on *.* to daily@'%' identified by 'xxx'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
by jason