修改mysql的root密码

用户名和密码存储在mysql库中

[root@bogon bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.87-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| my7gbi             |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql  --使用mysql库
Database changed

mysql> show tables;  ---查看表
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| func                      |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| proc                      |
| procs_priv                |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
17 rows in set (0.00 sec)

mysql> select user,password from user;
+-------+-------------------------------------------+
| user  | password                                  |
+-------+-------------------------------------------+
| root  |                                           |
| root  |                                           |
| root  |                                           |
|       |                                           |
|       |                                           |
| admin | *9B00BB7F1DFA94551387E9E6EFE479248551E897 |
| xuyh  | *9B00BB7F1DFA94551387E9E6EFE479248551E897 |
| admin | *9B00BB7F1DFA94551387E9E6EFE479248551E897 |
| admin | *9B00BB7F1DFA94551387E9E6EFE479248551E897 |
| xuyh  | *9B00BB7F1DFA94551387E9E6EFE479248551E897 |
+-------+-------------------------------------------+
10 rows in set (0.00 sec)

更新密码

update user set password=PASSWORD("czyd(2010)") where user='root';

commit;

mysqladmin -uroot -p password 'Hao!2#'    修改密码

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16566331/viewspace-678453/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16566331/viewspace-678453/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值