美文网首页
忘记root密码怎么办

忘记root密码怎么办

作者: Vekaco | 来源:发表于2019-09-18 19:14 被阅读0次

$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17

Copyright (c) 2000, 2016, 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> select * from user;
ERROR 1046 (3D000): No database selected
mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password = PASSWORD('12345')
-> ;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> alter user 'root'@'localhost' PASSWORD EXPIRE NEVER
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql>

相关文章

网友评论

      本文标题:忘记root密码怎么办

      本文链接:https://www.haomeiwen.com/subject/acwkuctx.html