CentOS下如何修改MySQL的root密码

树叶云

CentOS下如何修改MySQL的root密码

1、用帐号登录mysql

mysql –u root

或#mysql –uroot –p

2、改变用户数据库

命令: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

3、修改密码

    密码要用password()函数进行加密!!!!

命令:mysql> update user set password=password(‘root’) where user=’root’;

mysql> update user set password=password(‘root’) where user=’root’;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

4、刷新权限表

命令:mysql> flush privileges;

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

5、退出mysql并对mysql进行重启即可!!

service mysqld restart

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/201723.html<

(0)
运维的头像运维
上一篇2025-04-05 21:40
下一篇 2025-04-05 21:41

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注