Mysql常见命令

建立用户

create user testUser@'%'  identified by 'TEST';

'%' 能够过程访问  mysql

权限管理

TSET.* : TEST 数据库的全部表sql

grant all on TEST.*  to userTEST@'%';

导入

mysql test</root/dump.sql

备份

导出数据表结构 及数据 数据库

mysqldump  -u username -p  test>/usr/test.sql

建立索引ide

alter table uses  add index user_sex_index(sex)  comment 'uses 表中的 sex 索引';

 

查看某个表的建立 Sql

show create table offices

 

修改表 列的内容

alter table offices  modify  office_name varchar(30) not null  comment '科室名称';

 

修改数据库中数据的字符集

ALTER TABLE user_froms  CONVERT TO
CHARACTER SET utf8;

 

修改用户表的默认字条集

ALTER TABLE user_froms DEFAULT CHARACTER SET utf8;
相关文章
相关标签/搜索