Create MySQL user

This template generates the commands to create a new MySQL user with full permissions on a given database.

akonkol
February 16, 2012




mysql --user="root" -p'%{database_root_password}%'
CREATE DATABASE %{database_name}%;
CREATE USER '%{new_username}%'@'localhost' IDENTIFIED BY '%{password_for_new_username}%';
GRANT ALL ON %{database_name}%.* TO '%{new_username}%'@'localhost';
exit