mysql:创建新库,新表,查看character
创建新库create database wenda;
创建新表drop table if exists `user`;
create table `user`(
`id` int(11) unsigned not null auto_increment,
`name` varchar(64)not null default '',
`password` varchar(128) not null default '',
`salt` varchar(32) not null default '',
`head_url` varchar(256) not null default '',
primary key(`id`),
unique key name(`name`)
)engine=innodb default charset=utf8;
pk:primary key 主键
NN: NOT NULL是否可以为空
uq:unique 是否可以重复
ai:auto-incremental 自增
查看编码格式
show variables like 'character%';
character_set_client | utf8 |
character_set_connection | utf8 |
character_set_database | utf8 |
character_set_filesystem | binary |
character_set_results | utf8 |
character_set_server | latin1 |
character_set_system | utf8 |
character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\ |
修改编码格式
set character_set_database=utf8;