mysql 学习笔记(一)

时间:2014-05-24 07:49:23   收藏:0   阅读:332

查询:
show databases;

show status;

show tables;

desc  table-name;



更改root密码:
方法一:mysqladmin -uroot -poldpassword  password newpassword
方法二:
mysql -uroot -p
use mysql
update user set password=password("newpasswd") where user="root";

select host,user,password from user;

+-----------+------------------+-------------------------------------------+
| host      | user             | password                                  |
+-----------+------------------+-------------------------------------------+
| localhost | root             | *FAE22ED156CC483651E55164E12EE8597A798849 |
| c600      | root             | *FAE22ED156CC483651E55164E12EE8597A798849 |
| 127.0.0.1 | root             | *FAE22ED156CC483651E55164E12EE8597A798849 |
| ::1       | root             | *FAE22ED156CC483651E55164E12EE8597A798849 |
| localhost | debian-sys-maint | *BF673A86346B2E5CFFEFA24D36E2C520F0B82A49 |
| localhost | test             | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
+-----------+------------------+-------------------------------------------+

创建/授权用户:
grant select ,delete,update,insert,drop on db_name.* to user_name identified by "passwd" ;

grant all on db_name to user_name ;

 

mysql 学习笔记(一),布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!