Centos6.5使用yum安装Mysql5.7

想要玩新的东东就要付出代价,我的时间悄悄的都溜走了,说多了都是泪!

实践才是真理!

系统版本:Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

1.下载Mysql5.7依赖源,并进行安装

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

2.yum安装Mysql5.7

yum -y install mysql-server

MySQL 5.7 加强了root用户登录安全性,禁止空密码登陆,一些网友说会在/root/.mysql_secret文件里面生成随机密码,我是没有找到。

解决办法:

echo "skip-grant-tables">>/etc/my.cnf


启动服务,并进行修改密码

service mysqld start
mysql -uroot
update mysql.user set authentication_string=password('newPassword') where user='root' and Host = 'localhost';
flush privileges;
exit;

之后删除/etc/my.cnf中skip-grant-tables

sed -i '/skip-grant-tables/d' /etc/my.cnf

重新启动服务

service mysqld restart

使用新密码进行登陆

mysql -uroot -pnewPassword

登陆后还需要再次修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码';
原文地址:https://www.cnblogs.com/hands/p/5060365.html