sql语句

mysql


【创建账号】:


create user 'finance'@'%' IDENTIFIED BY ‘xxx’;


【给数据库权限】:


grant all on database.* to 'finance'@'%';


all可以换成 select,update,….


【撤销权限】:


revoke all on *.* from 'finance'@'%';


【跳过权限检测启动mysql】

解决root账号无权限的方法:


mysqld_safe --skip-grant-tables & 


update user set password=password(‘root’) where user=‘root’;


mysql -u root -p


【修改mysql库和表的编码】

SET character_set_client = utf8;

create database name character set utf8;

ALTER DATABASE `finance` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  

ALTER TABLE `finance`.`f_company` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  

ALTER TABLE `finance`.`f_condition` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  

ALTER TABLE `finance`.`f_config` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  

ALTER TABLE `finance`.`f_user` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  


【修改表引擎】


alter table table_name engine=innodb;  

alter table table_name engine=myisam;  


【修改表编码】

ALTER TABLE third.t_order_driver DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;


【每次创建时时间】mysql 5.6+

CURRENT_TIMESTAMP

【每次更新时修改时间】mysql 5.6+

CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

上一篇:【BZOJ3774】最优选择 最小割


下一篇:一款开源免费的.NET文档操作组件DocX(.NET组件介绍之一)