侧边栏壁纸
博主头像
学海无涯博主等级

学无止境

  • 累计撰写 321 篇文章
  • 累计创建 80 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

mysql 基础命令(一)

利刃
2015-04-01 / 0 评论 / 0 点赞 / 4 阅读 / 1369 字
温馨提示:
本文最后更新于 2024-08-13,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
创建数据库
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

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区