How to Add and Change a User to MySQL Databases

Database Managers provide a convenient solution for the scenarios in which databases are accessed concurrently, that is, we can have different users with different privileges, accessing the same database.
In this tutorial we will learn to add a user in mysql and then we will see how we can change the user privileges to access the database.

Step 1-Addning a user
To add a user to mysql, open up the php My Admin panel and click on the Users tab on top.
With the “users” page opened up, click on the “Add User” option.

New User

Step 2- User Information
After that, a new window will open up in which we can specify the details for the new user. For example, let’s give the user a Name, specify the Host option and give the desired password.
If we want to create the database with the same name as our username, we have to choose the second option under the Database for User Section, but for now, we will leave it to “None”, since we are assuming that we already have a database with a different name.

Specifying user Data

Step 3- Giving all privileges
Click on the “Check All” option in the Global Privileges section, and finally, scroll down and click on the “Add User” button. This was all about adding users in mysql.
Global privileges

Step 4- Editing privileges
Now let’s move to how we can change a user’s privileges in MySQL database.
For that, we have to click on the “Edit Privileges” option next to the username whose access has to be changed for the database.

User Privileges

Step 5- Finalizing Changes
Now scroll down to the “Database-specific privileges” section and choose the desired database from the drop down list. For example, we are granting this user access to the Sample database.
With that done, scroll down and click on GO to save the changes made.

Granting Database Access

And that’s how adding users in mysql can be done, along with the change of user’s privileges.