修改mysql密码

1、首先启动mysqld,无授权验证模式,为了安全,将监听地址bind在localhost
cmd>mysqld --skip-grant-tables --bind-address=localhost

2、运行mysql
cmd>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.90-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
mysql> select host, user, password from user;
+-----------+------+-------------------------------------------+
| host      | user | password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *41DDB5DFD213B288EE050BD64DC6AA36815A3486 |
+-----------+------+-------------------------------------------+
1 row in set (0.00 sec)

mysql> UPDATE user SET password=password('888') WHERE user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

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

mysql> quit;
Bye

cmd>

原文地址:https://www.cnblogs.com/xkxjy/p/3672264.html