Creating a MySQL Database
Most applications need a database, a database user, and a password before they can store any data. This page walks you through creating all three in cPanel and finding the connection details your software asks for.
Two Ways to Create a Database
In the Databases section of cPanel you will find two tools that do the same job in different ways:
- MySQL Database Wizard — A step-by-step guide that creates the database, the user, and the privilege grant all in one flow. This is the easiest option and the one we recommend if you are new to databases.
- MySQL Databases — A single page where you manage everything manually: create databases, create users, and add users to databases. Use this when you need finer control or are managing several databases and users.
localhost on port 3306.
Using the MySQL Database Wizard
The wizard is the quickest path from nothing to a working database:
- Open cPanel and, in the Databases section, click MySQL Database Wizard.
- Step 1 — Create a Database. Enter a name for your database and click Next Step.
- Step 2 — Create Database Users. Enter a username and a strong password (use the Password Generator if you like), then click Create User.
- Step 3 — Add User to the Database. Check ALL PRIVILEGES so the user can fully manage the database, then click Next Step.
- Step 4 — Complete the task. cPanel confirms the database and user were created. Note the full database name, username, and password for your application.
Creating a Database Manually
If you prefer the MySQL Databases page, start by creating the database itself:
- Open cPanel and click MySQL Databases.
- Under Create New Database, type a name for your database.
- Click Create Database.
Creating a Database User
A database on its own cannot be accessed until you attach a user to it. On the same MySQL Databases page:
- Scroll to MySQL Users > Add New User.
- Enter a username.
- Enter a strong password, or click Password Generator to create one automatically. Copy it somewhere safe.
- Click Create User.
Adding the User to the Database
The final step links the user to the database and grants permission to work with it:
- Scroll to Add User To Database.
- Select the User and the Database from the drop-down menus.
- Click Add.
- On the privileges screen, check ALL PRIVILEGES (this ticks every box below it).
- Click Make Changes.
The Account-Name Prefix
cPanel automatically prefixes every database and user name with your cPanel account name and an underscore. If your account is cpuser and you type wp as the database name, the real name becomes cpuser_wp. The same applies to users — typing wpuser creates cpuser_wpuser.
Always use the full prefixed names (for example cpuser_wp and cpuser_wpuser) when you configure your application. The prefix keeps your databases isolated from other accounts on the shared server.
What Your Application Needs
When you install a script such as WordPress, Joomla, or a custom app, it will ask for these four values:
- Database name — the full prefixed name, for example
cpuser_wp. - Database user — the full prefixed username, for example
cpuser_wpuser. - Database password — the password you set when creating the user.
- Database host — always
localhoston our servers.
localhost is correct even though the site is reached from the internet. You only need a different host for remote MySQL access.
Modifying Privileges
To change what an existing user can do, return to MySQL Databases and find the Current Databases table. Click the username to reopen the privileges screen, adjust the checkboxes, and click Make Changes. Most applications simply need ALL PRIVILEGES on their own database.
Deleting Databases and Users
In the Current Databases and Current Users tables, click Delete next to the database or user you want to remove and confirm.