20090422

how to add a new mysql user

How to add a mysql user, define permissions, and set password in one command.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
mysql> GRANT USAGE ON *.* TO 'dummy'@'localhost';

I primarily use the first method, however, obviously different circumstances (permissions) call for different commands.

After you make any permission or user changes be sure to run 'flush privileges;' to apply your changes. (Note: when you restart mysql new changes are applied at this time as well).

Link where information was taken from: http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

No comments:

Post a Comment