【SQL】常用写法汇总

ALTER用法 - 更改表字段:

  1. 增删字段:alter table table_name [drop|add] [column_name]

  2. 更改字段类型:alter table table_name alter column column_name data_type 

CREATE USER 用法:

   1. 查看系统用户: select Host,User,Password from mysql.user;

   2. 创建一个远程用户:create user test identified by '123456'; 

   3. 分配权限:grant all privileges on *.* to 'test'@'%'identified by '123456' with grant option; 

   4. 刷新mysql用户权限:flush privileges ;   

   5. 修改指定用户密码:update mysql.user set password=password('新密码') where User="test" and Host="localhost"; 

   6. 删除用户:delete from user where User='test' and Host='localhost';


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-BlogPHP 1.5.2 Zero

Copyright liuyang1.com. 转载文章,请注明出处。谢谢!