mysql忘记密码,登录不了时,重置密码:
1.my.cnf配置文件增加skip-grant-tables
2. 安全模式登录mysqld_safe
mysql-uroot 命令无密码登录
3.更新密码UPDATE mysql.user SET authentication_string = PASSWORD(‘123456’) WHERE user = ‘root’;
FLUSH PRIVILEGES;
mysql> grant all privileges on . to ‘root’@‘%’;
ERROR 1410 (42000): You are not allowed to create a user with GRANT
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 host=‘%’ where user=‘root’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> grant all privileges on . to ‘root’@‘%’;
Query OK, 0 rows affected (0.02 sec)
mysql> select user,host from user;
±-----------------±----------+
| user | host |
±-----------------±----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
±-----------------±----------+
8 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye

1949

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



