Gangmax Blog

My Tip 24

以下SQL脚本在MySQL中生成一个’dev’用户,并赋予它所有权限。可以参考MySQL5.1文档

1
2
3
4
5
6
7
8
9
10
create user 'dev' identified by 'dev';

GRANT ALL PRIVILEGES ON *.* TO 'dev'@'localhost';
flush privileges;

GRANT ALL PRIVILEGES ON *.* TO 'dev'@'%';
flush privileges;

SET PASSWORD FOR 'dev'@'localhost' = PASSWORD('dev');
SET PASSWORD FOR 'dev'@'%' = PASSWORD('dev');

(注意:不知道为什么在create user语句中设定的密码似乎不起作用,需要执行这两个set password语句来重新设定密码,才能够使dev帐号正常使用。)

Comments