mysql 基础命令(一)
创建数据库
create database db;
创建用户
create user 'aa'@'127.0.0.1' identified by '1234';
用户授权
grant all privileges on db.* to 'aa'@'127.0.0.1' with grant option;
创建表(设置主键,自动编码)
create table cj(id int not null primary key auto_increment,xm char(4) not null,nl int not null);
插入数据
insert into cj values('','sdfd',19);
修改数据
update cj set xm='fdd' where id =1;
删除数据
delete from cj where id =1;
删除自动编码
alter table cj modify id int not null;
删除主键
alter table cj drop primary key;
添加主键
alter table cj add primary key(id);
添加自动编码
alter table cj change id id int auto_increment;
删除用户
drop user 'aa'@'127.0.0.1';
删除数据库
drop database db;
二〇一五年四月一日 10:54:12
版权声明:
作者:龙魂
链接:https://blog.wlzs.cn/mysql-%e5%9f%ba%e7%a1%80%e5%91%bd%e4%bb%a4%ef%bc%88%e4%b8%80%ef%bc%89/
文章版权归作者所有,未经允许请勿转载。
THE END