Knowledgebase Article
Creating and Managing MySQL Databases in cPanel
Why Your Website Needs a Database
Most modern websites, including WordPress and many custom applications, store their content, settings, and user data in a database rather than in static files. MySQL is the most common database type used across cPanel hosting environments. If you have not yet read cPanel Basics: First Login Walkthrough, it covers how to reach the Databases section from your main dashboard.
Creating a New Database
Navigate to the Databases section and select MySQL Databases. Enter a name for your new database, then create it. cPanel typically prefixes your database name automatically with your account username, which helps avoid naming conflicts on shared hosting environments.
Creating a Database User
A database on its own cannot be accessed without a dedicated database user with the correct permissions. In the same MySQL Databases section, create a new database user with a strong, unique password. Once created, add this user to the database you just created, and assign it the appropriate permissions, typically All Privileges for a standard website setup.
Connecting Your Application
Most applications, including WordPress, require your database name, database username, database password, and typically a host value, most commonly localhost, entered into a configuration file during installation or setup. Keep these details recorded securely, since you will need them again if you ever need to reconnect or migrate your application.
Managing Your Database with phpMyAdmin
cPanel includes phpMyAdmin, a tool for viewing and directly editing your database's contents through a browser interface. This is useful for tasks like manually adjusting data, exporting a backup, or troubleshooting an issue your application's own interface does not expose directly. Access it through the Databases section, typically listed as phpMyAdmin.
Exporting and Importing Databases
To back up a database, open phpMyAdmin, select your database, and use the Export option, typically saving as a standard SQL file. To import a database, such as when migrating a website, select the destination database in phpMyAdmin and use the Import option, then choose your previously exported SQL file.
Common Issues
If your application cannot connect to its database, double check that the database name, username, and password entered in your application's configuration exactly match what was created in cPanel, since a small typo in any of these values is the most common cause of connection failures.