Skip to content

Knowledgebase

Creating a MySQL or MariaDB database in cPanel

cpanel-whm, development

Create a database through cPanel so the hosting account owns and tracks it correctly. The database stores application data; it is separate from the website files and from the database user that is allowed to connect to it.

Check access and requirements

Check the application’s database requirements and the account’s database allowance. Decide on a descriptive name and prepare a unique database password. Keep production and test applications in separate databases so a test import cannot overwrite live data.

01 Create a MySQL or MariaDB database in cPanel

  1. Open Database Wizard for a guided database-and-user setup, or Manage My Databases to create the database separately. Older versions may label these MySQL Database Wizard and MySQL Databases.
  2. Enter the database name and create it. Record the full name displayed after creation, including the account prefix if one is added.
  3. Create a dedicated database user and assign it to this database with the permissions the application needs. Creating a database alone does not grant a user access.
  4. Enter the full database name, user, password and supplied database host in the application’s installer or configuration. Do not assume the short name you typed is the final database name.

02 Example: copy the complete database connection details

For illustration, a cPanel account named acct might display a database called acct_shop and a database user called acct_shopuser. The exact names shown by your account are the values to use.

Application setting Example or source
Database name acct_shop, including the displayed prefix.
Database user acct_shopuser, assigned to that database.
Database password The private password created for this database user.
Database host The host supplied for the service, rather than a guessed address.

If the application reports access denied, compare these four settings with the actual cPanel database, user and assignment before creating another database.

Confirm the expected result

Confirm the database appears in cPanel and the application can connect. If installing a new application, complete its setup and check that tables are created in the intended database.

Why is the new database empty or reporting access denied?

Do not create account databases or users directly in phpMyAdmin because cPanel ownership mapping can be missed. For access-denied errors, check the full prefixed names, password and user assignment. An empty database is normal until an application or SQL import populates it.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support