Create a database user through the MySQL CLI

By | July 31, 2017

Through the mysql command line, this is accomplished by running the following commands.

In SSH, type “mysql” to access the mysql command line. Then type:
GRANT ALL PRIVILEGES
ON test_database.*
TO username@domain
IDENTIFIED BY ‘password’;
Where:

test_database is the database you created above.
username is the MySQL login to create
domain is the domain you’ll be connecting from — usually localhost, use “%” (double quote, percent, double quote) for any remote host, or specify a specific domain.
the password is your mysql password to create enclosed in single quotes.

For example:

GRANT ALL PRIVILEGES
ON forum2_database.*
TO admin_user@localhost
IDENTIFIED BY ‘forum911’;
• Tags:
• Databases,
• MySQL

Leave a Reply

Your email address will not be published. Required fields are marked *