# systemctl start mysqld
[root@yankerp ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
忘记Mysql密码如何找回解决办法
4.修改密码
MySQL> update MySQL.user set password=PASSWORD(‘新密码’) where User=’root’;
MySQL>flush privileges;
忘记Mysql密码如何找回解决办法
这时候我们发现它报错了,后来才发现原来是mysql数据库下已经没有password这个字段了,password字段改成了authentication_string这时候我们用authentication_string修改密码如下:
mysql> update mysql.user set authentication_string=password(‘123456′) where user=’root’;
忘记Mysql密码如何找回解决办法
执行完成后退出
5.这时候我们使用修改后的密码登陆mysql数据库
忘记Mysql密码如何找回解决办法