Skip to Content
Shared hosting (cPanel)Using cPanelDatabases

MySQL databases and phpMyAdmin

Most dynamic websites, such as WordPress and online stores, need a MySQL (or MariaDB) database to store their content and settings. This takes three things: a database, a user for it with a password, and linking the user to the database with the right privileges.

Installing WordPress?

If you install WordPress or another application with the automatic installers, they create the database and user for you, and you don't need these steps. See Install WordPress.

Database and user names

cPanel adds your account username and an underscore before the name of every database and every user. So if your account name is exampleu and you enter shop, the full name becomes exampleu_shop. Always use the full name in your site's configuration files.

The quick way: the Database Wizard

In the Databases section of cPanel, click Database Wizard.

Enter the database name and click Next Step.

Enter the username and a strong password (or use the Password Generator), save the password, then click Create User.

Enable ALL PRIVILEGES, then click Next Step. Setup is complete.

The manual way

Open Manage My Databases from the Databases section; in some versions it appears as MySQL Databases. This interface lets you do each task separately:

  • Create New Database: enter the name and click Create Database.
  • Add New User: enter the name and the password twice, then click Create User.
  • Add User To Database: choose the user and the database, click Add, then enable ALL PRIVILEGES and click Make Changes.
  • Change a user's password: in the Current Users table, click Change Password next to the user. Remember to update it in your site's configuration file too, or the site will stop connecting to the database.
  • Check and repair a database: use the Check Database and Repair Database sections, which help if you see messages about corrupted tables.

Connection details for your site

Put the following values in your site's configuration file (in WordPress, that's wp-config.php):

  • Database name: the full name including the prefix, such as exampleu_shop.
  • Username: the full name including the prefix.
  • Password: the database user's password, not your cPanel password.
  • Host: localhost.

phpMyAdmin: import and export

phpMyAdmin is a tool for managing the contents of your databases from your browser. Open it from the Databases section and choose your database from the sidebar.

Choose the empty database you created from the sidebar.

Click the Import tab, then Choose File, and select the .sql file (or a compressed .sql.gz or .zip file).

Click Import at the bottom of the page and wait for the success message.

Note

The maximum file size you can import is shown next to the file selection button. If your file is larger, compress it to .gz first; if it's still over the limit, open a support ticket and we'll help you import it.

Warning

Deletions and edits in phpMyAdmin take effect immediately and can't be undone. Export a copy of the database before making any direct changes to its tables.

Common issues

How is this guide?

On this page