ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 修改mysql的root密码

修改mysql的root密码

原创 Linux操作系统 作者:os-ora 时间:2010-11-18 16:51:25 0 删除 编辑

用户名和密码存储在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博客 ” ,链接:https://blog.itpub.net/16566331/viewspace-678453/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-01-12

  • 博文量
    148
  • 访问量
    410398