mysql之修改用户密码
原创
©著作权归作者所有:来自51CTO博客作者东山富哥的原创作品,请联系作者获取转载授权,否则将追究法律责任
文章目录
首先root用户登陆-mysql -u root -p
[root@izwz91h49n3mj8r232gqwez usr]# mysql -u root -p
Enter password:
输入上面密码成功登陆,如下
[root@izwz91h49n3mj8r232gqwez usr]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3284
Server version: 5.6.42-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
选择库-use mysql;
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>
修改指定用户的密码
mysql> UPDATE user SET password=PASSWORD("gaoxinfu") WHERE user='root';
Query OK, 5 rows affected (0.00 sec)
Rows matched: 5 Changed: 5 Warnings: 0
刷新权限后退出
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
使用新的密码登录即可;