Create and manage MySQL databases
Create a database and user in cPanel, grant privileges, and find the credentials an application needs to connect.
Create a MySQL database and a user that can reach it. Applies to shared, reseller and Premium hosting.
Most applications need three things: a database, a user, and that user granted privileges on it. Creating the first two and forgetting the third is the usual reason an install fails with a connection error.
Create a database and user
The wizard does all three steps in order, which is why it is worth using:
- In cPanel, open MySQL Database Wizard under Databases.
- Enter a database name, then Next Step.
- Enter a username and password — use Password Generator — then Create User.
- Grant All Privileges, then Next Step.
Keep the database name, username and password. You need all three to connect.
cPanel prefixes both names with your cPanel username. A database you name
wordpress becomes cpaneluser_wordpress, and that full name is what your
application must use.
Or do it manually
Under MySQL Databases you can create each part separately, which is what you want when adding a second user to an existing database:
- Create New Database — the database
- Add New User — the user
- Add User To Database — the grant, which is the step people miss
Connection settings
| Setting | Value |
|---|---|
| Host | localhost |
| Database | cpaneluser_dbname |
| Username | cpaneluser_dbuser |
| Password | as set |
| Port | 3306 |
localhost is correct because the database runs on the same server as your site.
Use it rather than your domain — it connects over a local socket, which is faster
and avoids the firewall entirely.
To connect from outside the server, see Allow remote MySQL connections.
Change a password
Under MySQL Databases → Current Users, select Change Password.
Remember to update it in your application's configuration at the same time —
wp-config.php for WordPress. Changing it in cPanel alone takes the site down.
Delete a database
Deleting is immediate and permanent. Take a backup first — see Download a backup of your account.
Check it worked
mysql -u cpaneluser_dbuser -p cpaneluser_dbname -e "SELECT 1;"A 1 back means the user, the password and the grant are all correct. Access denied almost always means the grant is missing, not that the password is wrong.