增:
create database database_name;
create table table_name(
id int not null AuTo_increment
zd1 char(5) not null
zd2 char(8) not null
primary key id
);
alter table table_name add 字段;
insert into table_name(字段1,字段2.。。。)values(‘xxx‘,‘xxx‘...);
删:
delete from table_name where between n1 and n2;
drop table table_name;
alter table table_name drop 字段;
查:
show databases;
show tables;
show create table_name;
desc table_name;
select 字段 from table_name where 条件;
select 字段,字段 from table_name order by id desc limit n;
改:
alter table old_table_name rename table_name;
updata table_name set 字段="xxx" where 条件;
alter table table_name rename 旧字段 新字段;
alter table table_name change 旧字段 新字段 字符类型;
授权:
grant select,insert,update,delete(or all privileges) on 数据库.数据表 to 用户名@"IP" identified by "密码" (with grant option ----可以给其他用户授权);
FLUSH PRIVILEGES;----保存更改并立即生效