Sunday, 9 September 2018

How to create database user account in MySQL



MySQL provides the CREATE USER statement that allows creating a new user account.

Run the following command to create database user in MySQL:

mysql> CREATE USER ‘username’@<’IPaddress / hostname’> IDENTIFIED BY ‘somepassword’;

Verify the privileges using following MySQL SHOW statement for user:

mysql> SELECT User,Host from mysql.user WHERE user=’username’;
+-------------+--------------------+
| User        | Host               |
+-------------+--------------------+
| username     | <IP address/hostname>   |
+-------------+--------------------+
1 rows in set (0.00 sec)

mysql>

Execute the following query to reload privileges:

mysql> FLUSH PRIVILEGES;

It done!!!

No comments:

Post a comment