Last updated: 5 April 2021
This article talks about creating a MySQL/MariaDB database via cPanel. Other articles in this section include:
The easiest way to create a new database in cPanel is via the MySQL Database Wizard. The Wizard guides you through the process in three easy steps.
The first step is to give your database a name. The first part of the name is always your cPanel user name followed by an underscore. The part after your user name can be anything you like. However, certain characters, such as spaces, are not allowed in database names. We recommend using letters, numbers and underscores only.
Image: Creating the database example_recipes.
Note: to be able to create a new database you need to have enough available databases on your account. All our web hosting plans allow at least one database. If you need more databases then you can either upgrade your hosting package or buy the MySQL database addon.
The next step is create a user for the database. Simply enter the user’s name, enter a password and click on Create User.
Image: Creating the user example_chef.
The final step is to link the user to the database. Here, you need to select the user’s privileges. A privilege is an SQL command the user can use. You can simply give a user all privileges but it is best practice to limit the privileges to those commands the user actually needs.
It is impossible for us to say exactly which privileges your website or application needs. WordPress and Drupal have the following recommendations:
Image: selecting the privileges for the example_chef user.
By default, tables in databases created via cPanel use the MyISAM storage engine. The main reason for this is that it easier to repair MyISAM tables (corrupted InnoDB tables can be difficult to repair). Another downside of InnoDB is that tables don’t release space when you delete data. However, if you prefer InnoDB, you can change the storage engine for individual tables via phpMyAdmin.
You are likely to see databases in cPanel referred to as MySQL or MariaDB databases. On our servers we use MariaDB but in cPanel databases are often named MySQL databases.
The reason for this is historic. In 2009, MariaDB was created as a “fork” of MySQL (because of concerns about the acquisition of MySQL by Oracle). MariaDB was designed as a “drop-in” replacement for MySQL, which made it easy for users to switch from MySQL to MariaDB. The two are still fully compatible, and for end users it therefore doesn’t matter whether the database is referred to as MySQL or MariaDB. For instance, if you are looking for documentation on the SQL syntax for, say, CREATE TABLE
queries then you can consult either the MariaDB Knowledgebase or the MySQL Reference Manual.