This article talks about creating a MySQL/MariaDB database via cPanel. Other articles in this section include:

Create a database with the help of the Wizard

The easiest way to create a new database in cPanel is via the MySQL Database Wizard. The Wizard will guide you through the process in three easy steps.

Step 1: create the database

The first step is to give your database a name. The first part of the name will be 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 (you will get a warning when you enter an illegal character). We recommend using letters, numbers and underscores only.

Creating a new database via cPanel's 'Database Wizard'.
Image: Creating a database. Here, the name of the database will be 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 packages allow at least one database. If you need more databases then you can either upgrade your hosting package or buy the MySQL database addon.


Step 2: create the user

The next step is create a user for the database. Simply enter the user name, enter a password and click on Create User.

Creating a new database user via the wizard.
Image: Creating a user for the database. Its name shall be example_chef.

The final step is to link the user to the database. At this stage you need to select which privileges the user should have. 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 SQL commands the database user actually needs.

It is impossible for us to say exactly which privileges your website or application requires and some content management systems, such as Magento, suggest enabling all privileges. WordPress and Drupal have the following recommendations:

  • For WordPress you typically only need ALTER, CREATE, DELETE, DROP, INDEX, INSERT, SELECT and UPDATE privileges.
  • For Drupal you need to add CREATE TEMPORARY TABLES to the above privileges.

Adding the user to the database.
Image: selecting the privileges for the example_chef user.

MyISAM vs InnoDB

By default, tables in databases created by 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). If you prefer to use InnoDB, you can change the storage engine used for individual tables via phpMyAdmin.

MySQL vs MariaDB

You are likely to see databases in cPanel referred to as MySQL and MariaDB databases. On our servers we use MariaDB but in cPanel’s interface 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.