修改mysql密码

1.登录mysql
mysql -uroot -p
2.修改密码需要use mysq的数据库

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| myflaskapp         |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.01 sec)

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 password=password('test123') where user='root';
Query OK, 3 rows affected (0.06 sec)
Rows matched: 3  Changed: 3  Warnings: 0

再次登录时,输入命令:

>mysql -uroot -p
>#这里输入新的更改后的密码

你可能感兴趣的:(修改mysql密码)