前提条件
下载yum repo 文件
一、卸载旧mysql
#rpm -qa |grep mysql
#rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps
二、安装repo
# rpm -i mysql57-community-release-el6-11.noarch.rpm
三、安装mysql
yum install mysql-community-server -y
四、修改配置文件/etc/my.cnf
datadir=/data1/mysql
character_set_server = utf8
collation-server = utf8_bin
transaction_isolation = READ-COMMITTED
五、初始化mysql
# /usr/sbin/mysqld --initialize --user=mysql
六、启动mysql
#service mysqld start
七、忘记root 密码
配置文件/etc/my.cnf 增加skip-grant-tables
重启mysql
八、登录修改root密码
update mysql.user set authentication_string=password('root123') where user='root' and Host='localhost';
九、重启mysql 输入root密码登录再次修改密码
set password for 'root'@'localhost'=password('root123');