修改mysql 的root密码

来源:互联网 发布:讲你知歌词 编辑:程序博客网 时间:2024/04/28 06:01

mysql

初始化的root密码都是为空的


root@ubuntu:~# mysql -u root -p
Enter password:                             -----------------------敲入回车

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.55-log Source distribution


Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


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


mysql> 


---------------开始修改root用户密码---------------------


mysql> use mysql

mysql> insert into user(Host,User,Password) values('%','root',PASSWORD('root'));
Query OK, 1 row affected, 3 warnings (0.00 sec)


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


查看表中显示信息


修改完成

原创粉丝点击