Database
This tutorial is part of the Cloud Expert Series.
Back to Cloud ExpertCategory: Advanced
Difficulty: 4 out of 5
Duration: 91 minutes
Find a mistake? Let us know the issue here.
Managing Database Users
Database user accounts can be used to control individuals’ or applications’ access to the databases in a Database instance. You might do this to limit access to information, or to limit damage if someone makes a mistake or some application code goes haywire.
In this section, we are going to learn how to add, modify and remove the users for a Database instance and manage their access.
Create a new Database User
- Navigate to the
Project/Database/Instancespage.
- Click your
tutorialinstance name and select theUserstab.
- Click the
Create Userbutton.
- In the
Create Userdialog, enterjohnnyin theNamefield and a strong password in thePasswordfield. Entertutorialin theInitial Databasefield, or the name of the database you created earlier.
- Click the
Create Userbutton. - You should see the
johnnyuser listed.
Note
The tutorial user we just created has credentials that permit login from any IP address (assuming that this is permitted by the Database instance). If you provide a value in the Host field, you can restrict the user so that they can only login from a specific machine.
Editting Database User
In this exercise, we are going to rename the user to tutorial_renamed and change their password.
- Navigate to the
Project/Database/Instancespage. - Click on the
tutorialinstance name and select theUserstab. - Click the
Edit Userfrom the actions list of one of the users.
- In the
Edit Userdialog, enter the new preferred name in theNew Namefield and a new strong password in theNew Passwordfield.
- Click
Apply Changesbutton. The password has been updated and you will see that the username has been changed to what you entered.
You can also modify the Host field this way.
Adding and Removing Database access
A Database User is initially allowed to access databases in the Initial Database list. Access to databases can be added and removed via the Manage Access action.
In this exercise, we are going to remove the tutorial user’s access to the tutorial database.
- Navigate to the
Project/Database/Instancespage. - Click on the
tutorialinstance name and select theUserstab. - Click the
Manage Accessfrom the actions list of usertutorial. - In the
Database Accesspage, look for the row for thetutorialdatabase. It should currently haveYesin theAccessiblecolumn. - Click the
Revoke Accessbutton, and the row should shortly update to sayNoin theAccessiblecolumn. - To restore access, you could then click the
Grant Accessbutton. - You can use your browser’s back button to return to the Database Instance page.
Note
The access control functionality provided by the Dashboard is a subset of that which is (typically) available using the database’s command line tool. For with the mysql command allows you control a user’s privileges down to the level of a single database table. Please refer to the relevant database user documentation for more details.
Removing a Database User
The procedure for removing a user from a Database instance is straightforward.
- Navigate to the
Project/Database/Instancespage. - Click on the
tutorialinstance name and select theUserstab. - Select the
Delete Useraction for thetutorialuser. - In the
Confirm Delete Userdialog, clickDelete User.
Caution
Deleting a user or removing a users access to a database may have the effect of stopping an application from working if it uses the user to login.