mysql回顾复习

来源:互联网 发布:hlsl 算法 编辑:程序博客网 时间:2024/05/17 00:57

修改密码:
mysqladmin -uroot -p password “新密码”
还可以进到里面去直接用sql语句修改。

数据类型:

整数

浮点数

日期核时间

字符串

二进制

数据库存储引擎:
show engines \G mysql 支持的所有的engine
show variables like ‘%engine%’ 查看当前库的engine

innodb

myisam

memory

创建 修改 删除 表
完整性约束条件表
not null 不能为空 primary key 主键 auto_increment 自动增长 unique 唯一索引
foreign key 外键
create table teable1 (id int PRIMARY KEY NOT NULL AUTO_INCREMENT,)

修改标名
alter table teable1 rename to table;

修改字段类型
alter table table1 modify id int(11111);
增加
alter table table1 add name not null;
删除
alter table table1 drop int ;
修改属性名
alter table table1 change name user char(22) not null ;

修改表的存储引擎
show create table table1\G
alter table user rngine=myisam;

删除表的外键
alter table table1 drop foreign key c_fk ;

0 0
原创粉丝点击