use mysql; update user set password=password('新密码') where user='root'; 之后执行下 mysql>FLUSH PRIVILEGES ; 关闭 重启 用新密码进入就可
Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。C:\Users\root>mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.10 MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trade of Oracle Corporation and/or its affiliates. Other names may be trades of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql Database changed mysql> set password password('fzg6160283'); ERROR 1193 (HY000): Unknown system variable 'password' mysql> set password for root=password('fzg6160283'); ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables opt ion so it cannot execute this statement mysql> update user set password=PASSWORD('fzg6160283') where user='root'; Query OK, 3 rows affected (0.09 sec) Rows matched: 3 Changed: 3 Warnings: 0mysql> flush privileges; Query OK, 0 rows affected (0.11 sec)mysql> exit ByeC:\Users\root>mysql -u root -p Enter password: ********** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.10 MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trade of Oracle Corporation and/or its affiliates. Other names may be trades of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> exit ByeC:\Users\root>mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N O)C:\Users\root>mysql -u root -p Enter password: ********** ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y ES)C:\Users\root> 你的方法没有问题 应该刷新权限
mysql>FLUSH PRIVILEGES ; 关闭 重启 用新密码进入就可
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。C:\Users\root>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.10 MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trade of Oracle Corporation and/or its
affiliates. Other names may be trades of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql
Database changed
mysql> set password password('fzg6160283');
ERROR 1193 (HY000): Unknown system variable 'password'
mysql> set password for root=password('fzg6160283');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables opt
ion so it cannot execute this statement
mysql> update user set password=PASSWORD('fzg6160283') where user='root';
Query OK, 3 rows affected (0.09 sec)
Rows matched: 3 Changed: 3 Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.11 sec)mysql> exit
ByeC:\Users\root>mysql -u root -p
Enter password: **********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.10 MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trade of Oracle Corporation and/or its
affiliates. Other names may be trades of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> exit
ByeC:\Users\root>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N
O)C:\Users\root>mysql -u root -p
Enter password: **********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)C:\Users\root>
你的方法没有问题
应该刷新权限
我现在遇到这个问题,恼火得很,不管用什么方法修改root密码,当时有效,重启mysql服务过后又没有密码了,root可直接进入