Mysql基础操作(命令行)

一、背景

docker安装mysql8,映射本地端口3306

二 、创建数据库

create database myblog charset=utf8;

 

三、选择数据库

use myblog;

 

 

四、查看所有表

show tables;

 

 

五、查看表结构

desc mm_t_user;

 

 

show columns from mm_t_user;

 

 

六、向表插入数据

插入第一条

insert into mm_t_user (insert_time,update_time,deleted,number,name,phone,content)
VALUES('2023-11-24','2023-11-24','0','1001','mm','13654854562','很厉害');

 

 

插入第二条

 

insert into mm_t_user (insert_time,update_time,deleted,number,name,phone,content)
VALUES('2023-11-24','2023-11-24','0','1002','Krystal','13654854563','很厉害吗');

 

 

 

插入第三条

insert into mm_t_user (insert_time,update_time,deleted,number,name,phone,content)
VALUES('2023-11-24','2023-11-24','0','1003','ck','13654854564','很帅气');

 

 

 七、查询表数据

select * from mm_t_user;

 

八、修改表字段

UPDATE mm_t_user SET content='ck' WHERE id=5;

 

 

九、删除表数据

DELETE FROM mm_t_user WHERE id=4;

 

posted @ 2023-11-24 17:39  lanrenka  阅读(51)  评论(0编辑  收藏  举报