How to create user in Azure MySQL database

In this article, we will see how create user in Azure MySQL database. We are going to create user in Azure MySQL server by using two ways.

1. Using GUI methods.
2. Using Create user statement.

1. Create User in Azure MySQL Database using Create User command:

Syntax to create MySQL User:

CREATE USER [IF NOT EXISTS] user [auth_option] [, user [auth_option]] ... DEFAULT ROLE role [, role ] ... [REQUIRE {NONE | tls_option [[AND] tls_option] ...}] [WITH resource_option [resource_option] ...] [password_option | lock_option] ... [COMMENT 'comment_string' | ATTRIBUTE 'json_object']

Examples:

Connect to Azure MySQL database from MySQL Workbench as shown in the video below.

Open the query windows then run the following command.

CREATE USER james@couponmysql IDENTIFIED BY 'James@123';

Then click on execute button to create it.

Then verify the user by running following query:

select user from mysql.user;

How to create user in Azure MySQL database

2. Create User in Azure MySQL Database using GUI method:

1. Click Users and Privileges in Administration panel from left menu as highlighted below:

How to create user in Azure MySQL database

2. Now click on Add Account as highlighted with yellow color below:

3. Then, provide Login Name, password and authentication type and Account limits, Administrative roles and Schema privileges. Now, click on apply.

4. Now, click refresh button at bottom or run below query to verify.

select user from mysql.user;