1,查看是否已经安装mysql软件
rpm -qa | grep -i mysql --color
2,卸载mysql
yum remove mysql mysql-server mysql-libs mysql-common
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf
或者
rpm -e --nodeps xxxx
3,下载rpm http://dev.mysql.com/downloads/repo/yum/
mysql-community-release-el6-5.noarch.rpm
链接:https://pan.baidu.com/s/1U4vkx4Xy5PiSt9maSd-JWg
提取码:wql6
4,安装仓库列表
yum localinstall mysql-community-release-el6-5.noarch.rpm
5,安装mysql
yum install mysql-community-server
6,启动mysql
service mysqld start
7,设置root用户密码
/usr/bin/mysqladmin -u root password "new-password"
8,开启mysql远程连接授权
grant all privileges on *.* to root@'%' identified by "password"
9,开放端口
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
或者
service iptables stop
10,创建用户并授权
grant FILE on *.* to 'backup'@'%' IDENTIFIED by '123456';
grant REPLICATION SLAVE ,REPLICATION CLIENT on *.* to 'backup'@'%' identified by '123456';
FLUSH PRIVILEGES;