修改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
>#这里输入新的更改后的密码
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容