码迷,mamicode.com
首页 > 数据库 > 详细

Centos下如何修改Mysql的root密码

时间:2016-05-23 00:40:06      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:

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

Centos下如何修改Mysql的root密码

标签:

原文地址:http://www.cnblogs.com/Arvinlinux/p/5518334.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!