启动mysql服务:mysqld
查看databases:
show databases;
创建名为db的数据库:
create database db;
进入db数据库:
use db;
查看数据库中的tables:
show tables;
创建表:
create table tb(
`id` varchar(50) not null,
`created_at` real not null,
primary key (`id`)
) engine=innodb default charset=utf8;
删除表tb:
drop table tb;
增加列age,not null表示default 0,也可以手动指定default 1。
alter table tb add column age int default 1;
alter table tb add column age int not null;
删除列:
alter table tb drop column age;
获取列名:
describe tb;