关于Windows下面安装mysql5.6后忘记密码怎么重置的问题
1.密码错误的时候会显示:
mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
2.停止服务:
net stop mysql;
3.进入到skip-grant-tables模式:
mysqld safe --skip-grant-tables
4.此时登录mysql是不会需要密码
指令mysql就可以进入mysql数据库
进入mysql系统数据库:
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
修改root账户密码:
mysql> update user set password=password("12345") where user="root";
Query OK, 4 rows affected (0.02 sec)
Rows matched: 4 Changed: 4 Warnings: 0
刷新权限:
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
停止mysql进程:
Stopped mysqld safe --skip-grant-tables
启动mysql:
net start mysql;
Starting MySQL SUCCESS!
使用刚才修改的密码进入mysql:
[root@oraserver139 ~] mysql -u root -p 12345
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.15
Copyright (c) 2000, 2013, 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> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> SET PASSWORD = PASSWORD('12345');
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
修改完成;
311



被折叠的 条评论
为什么被折叠?



