Creating a new user in MySQL from the command line with all permissions

This is purely because I’m lazy and don’t want to Google it every time I need to do it.

You’ll need to login via the command line first:

mysql -u root -p

When prompted enter your root password and you should be logged into a MySQL command line.

Run these two commands to create a new user account and give it full permissions to your MySQL server. Be sure to swap out the values for ‘someuser’, ‘somehost’ and ‘somepass’

CREATE USER 'someuser'@'somehost' IDENTIFIED BY 'somepass';
GRANT ALL PRIVILEGES ON *.* TO 'someuser'@'somehost' WITH GRANT OPTION;

References
http://dev.mysql.com/doc/refman/5.5/en/adding-users.html

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.