1,下载mysql57-community-release-el7-8.noarch.rpm 的 YUM 源
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
2,rpm -ivhmysql57-community-release-el7-8.noarch.rpm
3,reboot获得新密码 grep "password"/var/log/mysqld.log
4,登陆 mysql -uroot -p
5,提示登陆密码,就把刚刚的
密码复制进去
6,修改密码 alter user'root'@'localhost' identified by 'Zabbix_Yang01';
flush privileges;刷新才能生效
7,重新登陆即可
备注:
启动 MySQL 服务:
service mysqld start
关闭 MySQL 服务:
service mysqld stop
重启 MySQL 服务:
service mysqld restart
查看 MySQL 的状态:
service mysqld status
忘记密码时,可用如下方法重置:
# service mysqld stop
# mysqld_safe --user=root --skip-grant-tables --skip-networking&
# mysql -u root
mysql> use mysql;
mysql> update user setpassword=password("new_password") where user="root";
mysql> flush privileges;