centos6.5下如何修改MySQL默认用户root的密码

刚安装完MySQL后默认用户名和密码都是root,安全起见,必须把密码修改掉,那么如何修改呢?

1.用默认账号密码登录MySQL服务端

[root@domin ~]# mysql -u root -p

2.切换到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.执行更改密码的语句

mysql> update user set password=password('aaa') where user='root';

Query OK, 3 rows affected (0.01 sec)

Rows matched: 3  Changed: 3  Warnings: 0

4.刷新权限表

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

5.现在退出就可以用新密码登录啦~

mysql> exit;

Bye


你可能感兴趣的:(mysql,centos)