Skip to content
Shroti Host
Files and databases

How to create a MySQL database and user in cPanel

Steps last checked on by the Shroti Host team

Short answer

You create databases in cPanel under MySQL Databases and browse them in phpMyAdmin. A working database needs three things: the database, a user, and the user added to the database with privileges. We do not offer PostgreSQL on any plan.

Before you start

All shared, WordPress and unlimited hosting plans.

Steps

  1. Step 1: In cPanel open MySQL Databases and create the database.

  2. Step 2: On the same page, create a user with a strong password. Note the password now: cPanel does not show it again.

  3. Step 3: Add the user to the database on the same page, and grant All Privileges.

  4. Step 4: In your application's config, use localhost as the host, with the full database name and user name exactly as cPanel shows them. Both carry your account name as a prefix.

  5. Step 5: To look inside a database, or to import or export a .sql file, open phpMyAdmin in cPanel, select the database on the left, and use the Import or Export tab.

How to tell it worked

MySQL Databases lists the database with the user attached to it, and your application connects without a database error.

If it did not work

  • Access denied: the user is not attached to that database, or the name is missing your account prefix.
  • WordPress shows 'Error establishing a database connection': compare DB_NAME, DB_USER and DB_PASSWORD in wp-config.php with what MySQL Databases shows, and keep DB_HOST as localhost.
  • A large import stops partway: it is usually over the upload limit. Compress the .sql file and try again.

When to contact support

For an import that is still too large, upload the file with File Manager and open a ticket asking us to import it from the server side. Tell us the file name and the database.

We never ask for a password, a card number or an OTP. Do not put one in a ticket or a chat.

Shared hosting

MySQL databases and phpMyAdmin are included on every tier.