首页 > 数据库技术 > 详细

mysql笔记之最基本

时间:2016-06-21 20:58:20      阅读:179      评论:0      收藏:0      [点我收藏+]

增:

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;----保存更改并立即生效

mysql笔记之最基本

原文:http://10979518.blog.51cto.com/10969518/1791422

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!