How to Create and Manage MySQL Databases in cPanel
MySQL databases store and organize information used by websites and web applications. If your website uses WordPress, WooCommerce, or another database-driven application, a database is an essential part of how your website operates.
Lagrange Point Media (LPM) provides MySQL database management tools with its DIY Hosting plans, allowing you to create databases, manage database users, and work with stored information through cPanel.
This guide explains how to manage MySQL databases using cPanel's database tools and phpMyAdmin.
1. Accessing MySQL Database Tools
-
Sign in to the LPM Client Portal.
-
Open cPanel from your active hosting service.
-
Search for MySQL Databases or Manage My Databases.
-
Open the database management tool.
The exact name may vary depending on your cPanel interface and version.
From this area, you can typically create databases, manage database users, and assign permissions.
Note: LPM also provides access to phpMyAdmin, which allows you to work directly with database tables and records.
2. Creating a New MySQL Database
To create a database:
-
Open the database management tool in cPanel.
-
Locate the Create New Database section.
-
Enter a name for your database.
-
Click Create Database.
-
Confirm that the database appears in your list of existing databases.
cPanel commonly adds your hosting account username as a prefix to the database name.
For example, if your hosting username is example and you create a database named website, the full database name may appear as example_website.
Important: When configuring an application, use the complete database name displayed in cPanel.
3. Creating a Database User
A database user is an account that allows a website or application to connect to a database.
To create one:
-
Locate the MySQL Users or Add New User section.
-
Enter a username.
-
Generate a strong password using the available password generator.
-
Store the credentials securely.
-
Click Create User.
Database usernames may also include your cPanel account prefix.
Security Tip: Use a unique, strong password for each database user. Avoid reusing passwords from your hosting account or other services.
4. Assigning a User to a Database
Creating a database and a database user does not automatically connect them.
To assign a user:
-
Locate Add User to Database.
-
Select the database user.
-
Select the database.
-
Click Add.
-
Choose the permissions the user requires.
-
Save the changes.
Some applications, including typical WordPress installations, require a broad set of database privileges to install, update, and operate correctly.
For a standard WordPress database, you may need to select ALL PRIVILEGES.
Important: Grant database users only the permissions required by their applications. Avoid giving unrelated applications access to the same database.
5. Accessing phpMyAdmin
phpMyAdmin is a browser-based tool that allows you to inspect and manage the contents of MySQL-compatible databases.
To open it:
-
Sign in to cPanel.
-
Search for phpMyAdmin.
-
Open the application.
-
Select the database you want to manage from the navigation panel.
Inside phpMyAdmin, you can:
-
View database tables.
-
Inspect stored records.
-
Run SQL queries.
-
Import database files.
-
Export database contents.
-
Modify database structures.
Warning: Changes made through phpMyAdmin can immediately affect your live website. Incorrect SQL queries or database modifications may cause data loss or application errors.
6. Exporting a Database Backup
Exporting your database allows you to save a copy of its contents.
To export a database:
-
Open phpMyAdmin.
-
Select the database you want to back up.
-
Click the Export tab.
-
Select Quick for a standard export, or Custom if you need additional options.
-
Choose SQL as the export format.
-
Click Export to download the file.
Save the exported file somewhere secure.
Important: A database export does not include your website's files, themes, plugins, or uploaded images. A complete website backup generally requires both the database and website files.
7. Importing a Database
You may need to import a database when migrating a website, restoring data, or installing an application manually.
To import a database:
-
Open phpMyAdmin.
-
Select the destination database.
-
Click the Import tab.
-
Choose the SQL file from your computer.
-
Review the available import settings.
-
Click Import or Go to begin.
Depending on the file size and server configuration, large database imports may encounter upload or execution limits.
Warning: Importing SQL into a database containing existing information may overwrite or conflict with current tables and records. Create a backup before importing.
8. Connecting a Database to WordPress
WordPress stores its database connection information in a configuration file named wp-config.php.
The main connection settings include:
-
DB_NAME: The full database name.
-
DB_USER: The database username.
-
DB_PASSWORD: The database user's password.
-
DB_HOST: The database server hostname, commonly
localhostin shared hosting environments.
If you're installing WordPress manually, these values must match the database and user you configured in cPanel.
If WordPress was installed using an automated installer, the database connection is usually configured during installation.
Security Warning: The wp-config.php file contains sensitive credentials. Do not share it publicly or store unprotected copies in publicly accessible directories.
9. Troubleshooting Common Database Problems
Error Establishing a Database Connection
This WordPress error commonly indicates that the application cannot connect to its database.
Possible causes include:
-
Incorrect database credentials.
-
A database user that lacks the required permissions.
-
An incorrect database hostname.
-
A database service problem.
-
A missing or damaged database.
Check the connection settings in wp-config.php and confirm that the database and assigned user exist in cPanel.
Access Denied for User
This error may indicate an incorrect username or password, or insufficient database permissions.
Verify that the database user has been assigned to the correct database and has the necessary privileges.
Database Import Fails
Large SQL files may exceed upload or execution limits. SQL syntax errors or conflicts with existing tables can also cause imports to fail.
Review the error message before attempting another import.
10. Database Security Best Practices
To reduce the risk of database problems:
-
Use strong, unique database passwords.
-
Keep WordPress and other database-driven applications updated.
-
Avoid sharing database credentials.
-
Maintain current backups before making major changes.
-
Remove unused database users when they are no longer needed.
-
Avoid modifying database tables unless you understand the consequences.
LPM maintains scheduled hosting backups, including off-site copies, but customers should also maintain independent backups of important website data.
11. Getting Help from LPM
If you're unable to create a database, encounter connection errors, or experience problems importing or exporting data, contact LPM support.
Submit a support ticket through the LPM Client Portal.
Please include:
-
Your domain name.
-
The database tool you're using.
-
A description of the problem.
-
Any relevant error messages.
-
Whether the issue started after a recent website change.
Never include database passwords in a support ticket.
Additional Resources: