mysql入门语句10条

1,连接数据库服务器
mysql  -h host   -u root   -p  xxx(密码)

2,查看所有库
show databases;

3,选库
use 库名

4,查看库下面的表
show tables;

5,建表
create table msg(
id int auto_increment primary key,
content varchar(20),
pubtime int
)charst utf8;

6,告诉服务器你的字符集
set name gbk/utf8;

7,添加数据
insert into msg(id ,content,pubtime)value(1,罐罐,123456);

8,查询所有数据
select * from msg;

9,按ID查询一行
select * from msg where id=2;

10,快速清空表
truncate 表名

posted @ 2016-03-25 10:23  岁月无心  阅读(176)  评论(0编辑  收藏  举报