Development and databases

Create MySQL databases, users and permissions in cPanel

Reviewed on 4 min read MySQL databases

In cPanel, the Manage My Databases section (formerly MySQL® Databases) is where you create databases and users and give them permissions. To view or modify the tables, use phpMyAdmin.

If you would rather have cPanel guide you step by step, use the database wizard.

1. Create the database

In Create New Database, type a name and click Create Database. cPanel adds your cPanel username in front of it: if your username is miweb and you type tienda, the database will be called miweb_tienda. That full name is the one you will enter in your application.

Create a new database in cPanel

2. Create the user

Every database needs a user to connect. In Add New User, type the name (it will also get the prefix, for example miweb_tiendauser) and a password. Use the Password Generator to create a strong one and write it down.

Add a new MySQL user

3. Give the user permissions on the database

Creating the user does not give it access to anything. In Add User To Database, choose the user and the database, and click Add.

Link a user to a database

On the privileges screen, tick ALL PRIVILEGES and click Make Changes. This is what WordPress, PrestaShop, Joomla, Magento and almost any application need to create and update their tables.

Select all the user's privileges on the database

If the user is for something else, such as an external tool that only needs to read data, create a separate user and tick only SELECT.

4. Configure your application

In your website's configuration, use:

  • Server (host): localhost
  • Database: the full name, with the prefix (miweb_tienda)
  • Username: the full name, with the prefix (miweb_tiendauser)
  • Password: the one you set when you created the user

In WordPress, for example, these are DB_HOST, DB_NAME, DB_USER and DB_PASSWORD in the wp-config.php file.

Current databases

Current Databases lists the databases with their size and the users that have access. From here you can rename a database or delete it.

List of current databases in cPanel

  • Rename: cPanel copies the data to the new database and redoes the permissions. With large databases this can take a while, and in the meantime the website cannot connect. Afterwards, update the name in the application's configuration. If what you want is a copy for testing, it is better to clone the database.
  • Delete: deletes the database and all its data. Before you do, check that no website uses it (look for the name in its configuration file) and make a backup if you are unsure.

The size shown is updated periodically, not instantly.

Current users

In Current Users you can change a user's name or password, or delete it.

List of current MySQL users

If you change the name or password of a user that an application uses, the website will stop connecting ("Error establishing a database connection" in WordPress) until you enter the new details in its configuration file. Do it straight after the change.

To remove a user's access to a database without deleting the user, click the bin icon next to that user in the Current Databases list.

Check or repair a database

Despite its name, the Modify Databases section has two options:

  • Check Database: looks for damaged tables.
  • Repair Database: tries to repair damaged tables.

Check and repair a database in cPanel

Use them when the application shows errors such as "Table is marked as crashed" or "Incorrect key file for table". Repair works with MyISAM tables. If the damaged table is InnoDB (the usual type nowadays), repair has no effect: open a ticket with the error message and we will help you recover it or restore it from our backups.

You may also find useful

Something wrong or out of date? Tell us and we will review it.