一.查看系统中有没有mysql的源
yum repolist all | grep mysql
二.配置源
1.配置源
参考mysql官方给出的源配置,https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
新建文件
#/etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
2.配置key
新建/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql文件
从https://dev.mysql.com/doc/refman/5.6/en/checking-gpg-signature.html复制key过去
三.安装
1.再次查看源
yum repolist all | grep mysql
2.安装
yum install mysql-community-server
3.启动
service mysqld restart
4.重置默认密码
mysql -u root -p
mysql>use mysql;
mysql>UPDATE user SET Password=PASSWORD('newpwd') where USER='root';
mysql>FLUSH PRIVILEGES;
编译安装请参考:http://www.cnblogs.com/itfenqing/p/6054860.html