1.备份

mysqldump --all-databases -p -u root > /home/mysql.data.bak
cp /etc/my.cnf /etc/my.cnf.bak
cp -R /var/lib/mysql/mysql/ /var/lib/mysql/mysql_bak

2.删除老版本

yum remove mysql mysql-*
rpm -qa | grep mysql
yum remove mysql mysql-server mysql-libs compat-mysql51
yum list installed | grep mysql

3.安装

rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server

4.安装后升级

mysql_upgrade --protocol=tcp -P3306 -p

升级完成,密码和数据库会自动有的