数据库管理与高可用----第二章数据库管理

时间:2020-11-09 09:57:49   收藏:0   阅读:25
数据库管理与高可用----第二章数据库管理

一:数据库基本操作命令

◆ DDL语句创建库,表的命令

◆ DDL语句删除表库命令

◆ DDL语句修改表的属性

alter table:修改表的属性
alter table t2 add id int first; 增加一列成为第一列 
alter table t2 add id2 int after id; 在id后面增加一列叫id2
alter table t2 drop id2; 删除id2这个列 
alter table t2 change id ID bigint; 修改列名和数据类型
alter table t2 modify ID int; 修改列的数据类型 
show engines; 查看数据库有哪些存储引擎 
alter table t20 engine MyISAM; 修改表的存储引擎 
show create table t20; 查看修改存储引擎是否成功 
alter table t20 default charset=utf8; 修改表的语言编码
alter table am rename to  hasee;  修改am表名改为hasee
alter table info add column hobby int(3) not null;

◆ DML操作命令

◆ DQL操作命令

◆ DCL操作命令

mysql> create temporary table temp_kgc (id int(4) not null auto_increment,name varchar(10) not null,hobby varchar(10) not null, primary key(id))engine=innodb default charset=utf8;
mysql> insert into temp_kgc (name,hobby) values (‘tom‘,‘cat‘);

◆ 创建用户

create user username@host identified by ‘password‘;
可选项 @‘%‘ @ip @‘network‘ 

原文:https://blog.51cto.com/14625831/2547964

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!