|
| 1 | +--- |
| 2 | +title: 'Creating databases and users on your database server' |
| 3 | +slug: create-databases-and-users |
| 4 | +excerpt: 'Find out how to create a database on your database server' |
| 5 | +section: Private SQL |
| 6 | +order: 2 |
| 7 | +--- |
| 8 | + |
| 9 | +**Last updated 30th October 2020** |
| 10 | + |
| 11 | +## Objective |
| 12 | + |
| 13 | +A database (DB) is used to store what are known as dynamic elements, such as comments or articles. These databases are used in virtually all modern content management systems (CMS), such as WordPress or Joomla!. |
| 14 | + |
| 15 | +**This guide explains how to create a database on your database server and give access to users.** |
| 16 | + |
| 17 | +## Requirements |
| 18 | + |
| 19 | +- a [Private SQL Web Hosting plan](https://www.ovh.com/ca/en/web-hosting/sql-options.xml) |
| 20 | +- access to the [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager) |
| 21 | + |
| 22 | +## Instructions |
| 23 | + |
| 24 | +### Creating a database |
| 25 | + |
| 26 | +Log in to your [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager) and select `Web Cloud`{.action} in the top navigation bar. Click `Databases`{.action} in the services bar on the left-hand side, then choose the SQL instance concerned. Click on the `Databases` tab, then on `Add database`{.action}. |
| 27 | + |
| 28 | +{.thumbnail} |
| 29 | + |
| 30 | +Fill in the fields by following the criteria listed. You can create a user directly by ticking the **Create User** box. |
| 31 | + |
| 32 | +- **Database name** (obligatory): this will be your database’s name. |
| 33 | +- **Username**: This is name of the user that can log in to your database and perform requests (only applicable if the **Create User** box is ticked). |
| 34 | +- **Rights** (only if the box is ticked): the permissions that will be associated with the user on the database. For standard usage, select `Administrator`{.action}. The permissions can be modified as follows. |
| 35 | +- **Password**/**Confirm password** (only if the box is ticked): enter a password, then confirm it. |
| 36 | + |
| 37 | +Finally, click `Confirm`{.action}. |
| 38 | + |
| 39 | +{.thumbnail} |
| 40 | + |
| 41 | +### Adding a user |
| 42 | + |
| 43 | +To use an OVHcloud database server, you need to create users with specific rights to connect to a database. |
| 44 | + |
| 45 | +Log in to your [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager) and select `Web Cloud`{.action} in the top navigation bar. Click `Databases`{.action} in the services bar on the left-hand side, then choose the database name concerned. Next, switch to the `Users and rights` tab and click `Add user`{.action}. |
| 46 | + |
| 47 | +{.thumbnail} |
| 48 | + |
| 49 | +Enter a “username” and a “password”, then click `Confirm`{.action}. |
| 50 | + |
| 51 | +### Managing user rights |
| 52 | + |
| 53 | +To allow a user to perform actions on a database, it is necessary to assign permissions to the user. |
| 54 | + |
| 55 | +Log in to your [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager) and select `Web Cloud`{.action} in the top navigation bar. Click `Databases`{.action} in the services bar on the left-hand side, then choose the database name concerned. Next, switch to the `Users and rights` tab. Click on the `...`{.action} button to the right of the user concerned, then on `Manage rights`{.action}. |
| 56 | + |
| 57 | +{.thumbnail} |
| 58 | + |
| 59 | +In the left-hand column, **Database**, you will see a list of the databases on your database server. |
| 60 | + |
| 61 | +The 3 types of permissions proposed are described below: |
| 62 | + |
| 63 | +- **Administrator**: Authorisation of the following queries: **Select/Insert/Update/Delete/Create/Alter/Drop** |
| 64 | +- **Reading/Writing**: Authorisation of the following queries: **Select/Insert/Update/Delete** |
| 65 | +- **Read**: Authorisation of **Select** queries |
| 66 | +- **None**: No database rights |
| 67 | + |
| 68 | +> [!primary] |
| 69 | +> |
| 70 | +> The distribution of rights mentioned above is unique to OVHcloud. This will allow a user with *Administrator* rights to use **DLL** (Data_Definition_Language) and **DML** (Data_Manipulation_Language), while a user with **Reading/Writing** rights will only use **DML**. |
| 71 | +
|
| 72 | +{.thumbnail} |
| 73 | + |
| 74 | +#### Deleting a database |
| 75 | + |
| 76 | +> [!warning] |
| 77 | +> |
| 78 | +> Before deleting a database on a database server, there is no |
| 79 | +> checking of the contents of the database. It will be deleted even if |
| 80 | +> data is still stored in it, therefore it is recommended that |
| 81 | +> a backup is created and downloaded from your side before any deletion. |
| 82 | +> |
| 83 | +
|
| 84 | +Log in to your [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager) and select `Web Cloud`{.action} in the top navigation bar. Click `Databases`{.action} in the services bar on the left-hand side, then choose the SQL instance concerned. |
| 85 | + |
| 86 | +To delete a database on your database server, go to the `Databases` tab, then click on the `...`{.action} button to the right of the database concerned, then click `Delete the database`{.action}. |
| 87 | + |
| 88 | +{.thumbnail} |
| 89 | + |
| 90 | +## Go further |
| 91 | + |
| 92 | +Join our community of users on <https://community.ovh.com>. |
0 commit comments