How to Create Database User With Limited Access to Database

From this tutorial you’ll learn how to create a database user with limited access to a database. This might be helpful when you have several databases and don’t want the user to have all the privileges needed to manage them.

Creating Database User
  1. Let’s access your hosting server cPanel and locate Databases section. Here you need to click on phpMyAdmin tool.
  2. Click on New option and in the Database block fill in the new database name. Then click on Create button.
  3. Navigate to Users tab and in New block and click on Add User option. In the Username field define the new username.
  4. In the Password field type in the password.
  5. Locate Grant All Privileges on Database (your new database name) option and check it in the Database for User block. Then click on Go button. As a result, the user will have all privileges only for one single database you’ve defined.
  6. If you need to change user privileges, you have to navigate to Databases tab and click on Check Privileges option.
  7. Select the new user from the users list and click on Edit Privileges option. Note, that you can assign other users and give them privileges to manage your new database the same way.
  8. Switch from Global to Database tab to edit the privileges for this single database. You might need to select the database to which you want to assign the user. In the empty field you’ll have to type in your password to confirm that you want to change privileges.
  9. Here you can set the specific privileges for this user in Data, Structure and Administration blocks.Create Database User
  10. Let’s learn the meaning of the most used privileges:
    • Alter — allows modifying existing data.
    • Drop — allows dropping database and its tables.
    • Create — allows creating extra tables.
    • Insert — allows inserting data.
  11. When you’ve changed the privileges to your preferable ones click on Go button to save the changes.