数据库密码遗忘如何重置

root@localhost ~]# vim /etc/my.cnf

最后一行加skip-grant-tables

[root@localhost ~]# systemctl restart mysql
[root@localhost ~]# mysql -uroot -p

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set authentication_string=password('1') where user='root';
Query OK, 1 row affected, 1 warning (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


版权声明:本文为qq_58268157原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。