Last Updated: February 25, 2016
·
980
· ekupelian

Create user and grant permissions in 1 line

Issue the following query to create a user and grant permissions on a MySQL database all in one line:

GRANT ALL ON database_name.* TO 'user_name'@'localhost' IDENTIFIED BY 'user_passwd';
  • Remember: replace databasename, username, user_passwd accordingly