MySQL 5.7更改Root密码和Host

MySQL5.7对用户密码管理对更为严格。

为测试方便,需要将root对权限扩大为所有host。具体操作如下:

grep 'temporary password' /var/log/mysqld.log
2019-05-14T04:58:05.705428Z 1 [Note] A temporary password is generated for root@localhost: lXOe3R-jhV6W

mysql -uroot -plXOe3R-jhV6W

alter user 'root'@'localhost' identified by 'xxxxxxx'; 

uninstall plugin validate_password;

alter user 'root'@'localhost' identified by 'xxxx';

GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxx;

附CentOS7安装MySQL5.7的命令:

yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

yum install mysql-community-server

 

posted @ 2019-05-14 13:32  衡子  阅读(4727)  评论(0编辑  收藏  举报