1、拉取安装包
wget --no-check-certificate dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
成功拉取

2、安装
yum install mysql-community-release-el6-5.noarch.rpm

过程中可能需要你同意一些东西,y 即可
然后稍微检查一下
yum repolist enabled | grep mysql

开始正式安装
yum install mysql-community-server
过程中需要输入大概三次 y

complete! 出现得时候就成功了
3、启动
service mysqld start

后面出现 [OK] 就是成功了
4、自启动
检查是否自启动
chkconfig --list | grep mysqld

未开启
chkconfig mysqld on**// 开启自启动**

5、修改字符集
避免中文出现乱码
进入配置文件
vim /etc/my.cnf

重启mysqld
service mysqld restart

输入 mysql_secure_installation
现在mysql还没有密码需要设置一下
注意里面有一个要 NO

6、打开权限
进入mysql
mysql -uroot -p
然后输入密码
因为刚刚修改了mysql的权限,刷新一下数据库的权限表。

然后改一下user表就行了
use mysql;
update user set host = '%' where user = 'root' and host='localhost';
GRANT ALL PRIVILEGES ON . TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
然后就能连接上了。