November 20, 2008

Adding A User In MySQL

Do you need to quickly add a specific user with access to only a certain table? Issue this command as a root or admin user:

GRANT ALL ON testdb.* TO 'testuser'@'localhost' IDENTIFIED BY 'pass1';

You can also limit user’s privileges to specific ip addresses or domains in case you need to access your databases from a different host.

GRANT ALL ON *.* TO 'testuser'@'remote.farmsoftstudios.com' IDENTIFIED BY 'pass1';