首页 > 数据库技术 > 详细

linux下mysql常用的命令

时间:2015-07-31 10:52:44      阅读:335      评论:0      收藏:0      [点我收藏+]

linux下搭建完mysql后,一些常用的数据库命令:

创建库:create database mydatabase;
显示所有数据库列表:show databases;
删除数据库:drop dabatase mydatabase;
制定mydatabase为当前默认数据库:use mydatabase;
创建表:create table custmoers(userid int not null,username varchar(20)not null);
删除表:drop table cutomers;
显示表:show tables;
显示表结构:desc customers;
向customers表中插入一条记录:insert into customers(userid,username) values(1,‘hujiahui‘);
让操作即时生效:commit;
查询customers中的记录:select * from customers;
更新表中的数据:update customers set username=‘licongying‘ where userid=1;
删除表中的记录:delete from customers;
授予hjh用户访问数据库的权限:grant select,insert,update,delete on *.* to hjh@localhost identified by"123456",其中hjh是用户名
          123456是密码
登录mysql:mysql -uhjh -p123456

                                                                                             新浪微博@皮子喜欢打篮球














linux下mysql常用的命令

原文:http://my.oschina.net/pppi/blog/485955

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!