How to Create a MySQL Database and User in cPanel

Most website software, including WordPress, Joomla and online shops, stores its content in a MySQL database. This guide shows how to create a MySQL database and user in cPanel, connect them, and find the details your website needs to use them. Your Instant Access Internet Services plan includes unlimited databases.

If you're installing WordPress, you don't need to do this: WP Toolkit creates the database for you automatically.

What you'll end up with

Every database needs three pieces that work together:

  • A database, for example username_shop.
  • A database user with a password, for example username_shopuser.
  • The user added to the database with permission (privileges) to use it.

cPanel automatically puts your cPanel username and an underscore in front of every database and user name, so if you type shop, the full name becomes username_shop. Always use the full name in your website's settings.

The quick way: Database Wizard

The Database Wizard walks you through all three steps in order.

  1. Log in to cPanel and go to Databases > Database Wizard.
  2. Step 1: Type a name for the New Database and click Next Step.
  3. Step 2: Type a Username, then enter a Password twice or click Password Generator. Copy the password somewhere safe, then click Create User.
  4. Step 3: Tick ALL PRIVILEGES and click Next Step.
  5. Step 4: You'll see a confirmation that the user was added to the database. You're done.

Step by step with Manage My Databases

Use this method if you want to add an existing user to a new database, or manage several databases at once.

1. Create the database

  1. In cPanel, go to Databases > Manage My Databases.
  2. Under Create New Database, type a name in New Database.
  3. Click Create Database, then Go Back.

2. Create the database user

  1. On the same page, scroll to Add New User.
  2. Enter a Username and a strong Password (twice), or use Password Generator. Save the password somewhere safe; cPanel can't show it to you again later.
  3. Click Create User, then Go Back.

3. Add the user to the database

  1. Scroll to Add User To Database.
  2. Choose your new user from the User menu and your new database from the Database menu, then click Add.
  3. On the privileges page, tick ALL PRIVILEGES and click Make Changes.

Skipping this last step is the most common reason a new website can't connect to its database.

Database connection details for your website

When your software asks for database settings, use:

SettingValue
Database host / serverlocalhost
Database nameThe full name, e.g. username_shop
Database usernameThe full name, e.g. username_shopuser
PasswordThe password you set for the database user
Port3306 (usually filled in automatically)

The database password is not your cPanel password. It belongs only to the database user.

Common questions

How do I see what's in the database?

Go to Databases > phpMyAdmin and click the database name in the left-hand panel. You can browse tables, run queries, and import or export data there.

Can I connect to my database from my own computer?

Databases only accept connections from the server itself, and Remote MySQL isn't offered. To work on your database from a desktop app such as HeidiSQL, MySQL Workbench or TablePlus, connect through an SSH tunnel -- see How to Connect to Your Database from Your Computer with an SSH Tunnel. For quick jobs, phpMyAdmin in cPanel needs no setup at all.

I forgot the database user's password

cPanel can't show it, but you can set a new one. See the guide on changing a MySQL user's password below, and remember to update your website's config file afterwards.

How do I delete a database I no longer need?

In Manage My Databases, find it under Current Databases and click Delete. This permanently removes all its data, so export a copy first if you might need it. Make sure no website is still using it (check DB_NAME in wp-config.php for WordPress sites).

Related guides

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • create mysql database cpanel, cpanel database wizard, add user to database cpanel, manage my databases, mysql database for wordpress, database host localhost
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Change a MySQL Database User's Password

You might need to change a database password after a security scare, when a developer leaves, or...

How to Import and Export a Database with phpMyAdmin

phpMyAdmin lets you save a copy of a database to your computer or load a database from a file,...

How to Open phpMyAdmin from cPanel and Find Your Way Around

phpMyAdmin is a web page for looking inside your MySQL databases: you can see the tables your...

How to Move a MySQL Database from Another Host to Your Account

Moving a website to us usually means moving two things: the files and the MySQL database behind...

How to Import a Database That's Too Big for phpMyAdmin (Using SSH)

phpMyAdmin on your hosting account accepts import files up to 50 MB, and even smaller files can...