当前位置:Gxlcms > 数据库问题 > linux下mysql常用的命令

linux下mysql常用的命令

时间:2021-07-01 10:21:17 帮助过:41人阅读

创建库: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常用的命令

标签:

人气教程排行