Introduction
The MG panel provides direct access to interfaces for MySQL and PostgreSQL website database management. You can create and delete databases, add MySQL users with privileges, and much more.
In what follows, we will confine ourselves to information on using the MySQL and PostgreSQL interfaces for beginner users.
MySQL database users may also refer to the article How to Manage Databases with PhpMyAdmin.
Prerequisites
Access to https://mg.n0c.com/en/.
Concepts to be Known
Details on MySQL Databases Users Privileges
Throughout this article, some English terms related to MySQL databases users privileges will come up often. We invite you to refer to the table below to understand their meaning.
Privilege | Definition |
ALTER | Modify properties (ALTER AGGREGATE, ALTER CONVERSION, etc.). |
ALTER ROUTINE | Modify the definition of a routine, that can be an aggregate function, a normal function or a procedure. Routines are SQL objects that allow defining a logic to apply to data. |
CREATE | Define a table (CREATE TABLE), a new database (CREATE DATABASE), etc. |
CREATE ROUTINE | Group stocked functions and procedures. |
CREATE TEMPORARY TABLES | Create a temporary table. A temporary table exists only in the session that created it. |
CREATE VIEW | Define a view. A view is a virtual table; in other words, it is a table whose data are not stored in the database, and containing informations from many tables. |
DELETE | Delete lines in a table. By using commands associated to WHERE, it is possible to select the lines that will be deleted. |
DROP | Permanently delete a table from a database (DROP TABLE), a role (DROP ROLE), etc. |
EVENT | Allow to obtain data to monitor or solve problems in SQL. |
EXECUTE | Execute a prepared instruction. |
INDEX | Perform commands associated to indexes such as CREATE INDEX. With an index placed on one or many columns, a database system can first search data on the index and, if what is searched is found, it knows more rapidly where are the records. |
INSERT | Insert data in a table. |
LOCK TABLES | Lock a table. |
REFERENCES | The reference permission on a table allows to create a foreign key that refers to this table; this way, administrators can perform required modifications without having to take into account the needs of the persons to whom the table has been referenced. |
SELECT | Return the records in a result table. This command can select one or many columns in a table. |
SHOW VIEW | Display the value of a executions parameter. |
TRIGGER | Execute a set of SQL instructions right after an event. |
UPDATE | Perform modifications on existing lines. Often, this command is used with WHERE to specify on which lines the modification is applicable. |
Icons for Managing Passwords
When you have to create or change passwords, there are some icons that will be very useful. The table below explains their meaning.
Icon | Description |
1 | Hide (or display) password. |
2 | Password complexity (a red icon shows that the password is not secure enough). |
3 | Generate a password. |
4 | Copy the password. |
Access to MySQL and PostgreSQL Interfaces
To open MySQL, choose Databases -> MySQL in the contextual menu to the left:
To open PostgreSQL, choose Databases -> PostgreSQL in the contextual menu:
These interfaces are very similar. In both cases, you will notice that CURRENT DATABASES are displayed at the top of the window and CURRENT USERS are listed at the bottom.
Database Creation
Create a MySQL Database with a New User
- Access to MySQL databases interface and click on the Create button:
- Enter the name of the DATABASE:
- It is recommended to create a database user at this point. Check Create Database User checkbox.
- Provide the USERNAME:
- Provide the PASSWORD.
- Set the user’s privileges by checking or unchecking the appropriate boxes.
- Click on the CREATE button.
- Confirmation messages are displayed and the database is added to the list of CURRENT DATABASES.
Create a PostgreSQL Database with a New User
- Access to PostgreSQL databases interface and click on the Create button:
- Enter the name of the DATABASE:
- It is recommended to create a database user at this point. Check Create Database User checkbox.
- Provide the USERNAME.
- Provide the PASSWORD.
- Click on the CREATE button.
Create a Database User
Access the MySQL or PostgreSQL database interface.
- In the CURRENT USERS section, click on the Create button:
- Fill in the USERNAME field:
- Provide a PASSWORD.
- Choose the ASSOCIATED DATABASE from the drop-down list.
- For MySQL databases only, set user privileges in the appropriate boxes:
- Click on the CREATE button.
- Confirmation messages are displayed and the user is added to the list of CURRENT USERS.
Modification of a Database User’s Username or Password
Access the MySQL or PostgreSQL database interface and locate the user whose name or password you wish to change in the CURRENT USERS section.
- Click on the Rename or change password icon :
- Enter the new USERNAME and/or PASSWORD in the appropriate field:
- Click on the SAVE button.
- Confirmation messages are displayed.
Adding a User to a Database
Typically, several users will need to connect to the database. You need to add them one by one.
Access the MySQL or PostgreSQL database interface and locate the database to which users are to be added in the CURRENT DATABASES section.
- Click on the Add another user icon, as in this example for a MySQL database:
If it is a PostgreSQL database, the interface will look like this:
- Select the USER name from the drop-down list:
- Click on the ADD button.
- A confirmation message is displayed.
- The user is displayed alongside the corresponding database.
Modifying MySQL Database User Privileges
MySQL database user privileges can be modified at any time.
Access the MySQL database interface and locate the database for which privilege changes are to be made.
- Click on the Modify user privileges icon:
- Check or uncheck the appropriate boxes:
- Click on the SAVE button.
- A confirmation message is displayed.
Deleting a User
It is advisable to delete users who no longer use your databases.
Access the MySQL or PostgreSQL database interface and locate the user to be deleted in the CURRENT USERS section.
- Click on the Delete icon:
- Approve the deletion at the command prompt.
- A confirmation message is displayed.
Remove User Access to a Database
It is essential to keep your database users’ access rights up to date. It is both pointless and risky to neglect to remove rights from a user you do not expect to work with.
Access the MySQL or PostgreSQL database interface and locate the database and user whose privileges are to be withdrawn.
- Click on the Delete icon, as in this example for a MySQL database:
If it is a PostgreSQL database, the interface will look like this:
- Approve the deletion at the command prompt.
- A confirmation message is displayed.
Deleting a Database
It is advisable to delete your databases if they are no longer in use.
Access the MySQL or PostgreSQL database interface and locate the database in the CURRENT DATABASES section.
Click on the Delete icon, as in this example for a MySQL database:
If it is a PostgreSQL database, the interface will look like this:
References
How to Manage Databases with PhpMyAdmin.