Skip to main content
MotherHosting

Create a MySQL database in cPanel

Create a database and a database user in cPanel, give the user its privileges, open phpMyAdmin and import a .sql file.

Last updated 2 min read

WordPress and most other website software keep their content in a MySQL database. Creating one in cPanel takes three small steps: the database, a user, and the link between the two.

Create the database and its user

  1. Log in to cPanel and open MySQL Databases.

  2. Under Create New Database, type a short name and press Create Database. cPanel puts your cPanel username in front, so the full name looks like user_shop.

  3. Go back to the page. Under Add New User, type a username and a strong password (the Password Generator helps), press Create User and note the password.

  4. Under Add User To Database, choose the user and the database and press Add.

  5. Tick ALL PRIVILEGES and press Make Changes.

What your website needs

When the website software asks for its database details, give it:

  • Database name: the full name with the part in front, for example user_shop.

  • Username: the full database username, also with the part in front.

  • Password: the password of the database user, not your cPanel password.

  • Host: localhost.

Open phpMyAdmin

phpMyAdmin shows what is inside your databases. In cPanel, open phpMyAdmin; it opens already signed in. Your databases are listed on the left.

Import a .sql file

Use this when you move a site and have its database as a .sql file.

  1. In phpMyAdmin, click the database on the left that should receive the data. A new, empty database is the safe choice.

  2. Open the Import tab.

  3. Press Choose File and pick the .sql file. A compressed file (.sql.zip or .sql.gz) works too.

  4. Leave the other settings as they are and press the button at the bottom of the page (Import or Go, depending on the version).

A green message tells you that the import finished, and the tables appear on the left.

Good to know

  • Importing into a database that already has tables with the same names can replace their content. If the data matters, save a copy first with the Export tab.

  • The Import page shows the largest file it accepts. Compress a bigger file first; if it is still too big, open a ticket and we will help.

  • An "access denied" error at the very start of an import usually means the file tries to create or use a database with another name. Click your own database first. If the error stays, ask for an export of the tables only.

  • How many databases you can create depends on your plan.

Need help? Open a ticket in Support, department Technical, category cPanel.

Still need help?

Open a ticket and our support team will help you. We will see which article you read.

Open a ticket

To order, contact us

Tell us the plan or domain you want. We set up your order and send you the invoice.