Databases are essential for running dynamic websites and applications like WordPress, forums, or custom PHP systems. This guide covers how to create, manage, and access your MySQL databases in cPanel.
Creating a New MySQL Database
-
Log in to your cPanel account.
-
Scroll down to the Databases section.
-
Click on MySQL® Databases.
-
Under Create New Database, enter a name and click Create Database.
Your new database will be created with a prefix (e.g., youruser_databasename).
Creating a Database User
-
In the same MySQL Databases section, scroll to MySQL Users.
-
Enter a username and password.
-
Click Create User.
Assigning the User to the Database
-
Scroll to the Add User to Database section.
-
Select the user and database you just created.
-
Click Add.
-
On the next screen, select the privileges you want to give (usually "All Privileges") and confirm.
Accessing phpMyAdmin
Once your database and user are created:
-
Go back to your cPanel home page.
-
Click phpMyAdmin under the Databases section.
-
Select your database on the left to:
-
Browse and edit tables
-
Import or export data
-
Run SQL queries
-
Back up or restore manually
-
Importing a Database File (.sql)
To import an existing database:
-
Inside phpMyAdmin, select your database from the left sidebar.
-
Click the Import tab at the top.
-
Choose your
.sqlfile from your computer. -
Click Go to begin the import.
Exporting a Database Backup
-
In phpMyAdmin, select your database.
-
Click the Export tab.
-
Use the Quick method and SQL format, then click Go.
This will download a backup of your database to your device.
Tips and Best Practices
-
Always back up your database before making major changes.
-
Avoid using generic usernames like
adminfor database users. -
Use strong, unique passwords for database users.
-
Limit privileges to what's necessary for added security.
Need Help?
If you're unsure how to structure your database or run SQL queries, our support team can guide you through the process.
