Ⅰ创建数据库使用create语句:
create database 数据库名;
Ⅱ创建表同理:
create table if not exists 表名 (
字段名 数据类型 主键 约束,
字段名 数据类型 主键 约束)
设置存储引擎和字符集; 如ENGINE=InnoDB DEFAULT CHARSET=utf8;
Ⅲ插入字段后面:
alter table 表名 modify column 字段一名字 字段类型 after 字段名二;
补充:插入到表第一行:alter table 表名 modify column 字段名 数据类型 first;
Ⅳ修改字段数据类型:
alter table 表名 modify column 字段名 修改后的类型;
Ⅴ修改字段名使用change关键字:
alter table 表名 change 原名 修改后的名字 修改后的字段名;
Ⅵ增加字段,使用add关键字:
alter table 表名 add 新增字段名 字段类型 约束;
Ⅶ修改表名,使用rename关键字:
alter table 表名 rename 新表名;
Ⅷ删除字段,使用drop关键字:
alter table 表名 drop 字段名;
Ⅸ修改表存储引擎为MyISAM,使用engine关键字:
alter table 表名 engine=MyISAM;
Ⅰ创建用户设置密码并给权限,:
create user account1@localhost identified by 'oldpwd1';
grant select,insert,update(info) on 数据库.表名 to account1@localhost;
Ⅱ更改用户密码:
alter user account1@localhost identified by ’新密码;'
Ⅲ刷新权限:
flush privileges;
Ⅳ查看用户权限:
show grants for account1@localhost;
Ⅴ收回权限revoke:
revoke all on *.* from account1@localhost;
Ⅵ删除用户帐号信息:
drop user account1@localhost;