停止MySQL

service mysqld stop

备份数据

mkdir /var/lib/mysqlcopy
cp -aR /var/lib/mysql/* /var/lib/mysqlcopy

安装MySQL的源(如果需要mysql 5.6之类的版本的话可以修改这个文件/etc/yum.repos.d/mysql-community.repo)

yum install http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

安装MySQL

yum install mysql

启动MySQL

service mysqld start

如果此时重启MySQL会遇到下面的问题(vi /var/log/mysqld.log):
Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
具体的操作方法是
窗口1

mysqld --skip-grant-tables

窗口2中执行命令

mysql_upgrade

killall mysqld关闭MySQL
重启下面的服务

service mysqld start
service httpd restart
service nginx restart
service psa restart

验证是否成功可以通过访问https://ip:8443来验证