MySQL Databases in cPanel: Create a Database, User, and Use phpMyAdmin Securely¶

Databases are where your app stores the real value: users, orders, posts, settings.
In cPanel, the winning formula is simple: Database + User + Correct Permissions.
This guide covers the full flow and the security baseline you should not skip.
Before you start¶
You need: - Access to cPanel - A plan with MySQL databases enabled - Your application requirements (some apps need specific charset or privileges)
WordPress?
WordPress typically needs full permissions on its own database. You still should keep it isolated with a dedicated user and database.
Step 1: Create a MySQL database¶
- Log in to cPanel.
- Open MySQL Databases.
- Under Create New Database, enter a name.
- Click Create Database.
You will usually see a prefix (example: gozenuser_wpdb). That is normal in cPanel environments.
Step 2: Create a database user¶
- In MySQL Databases, find MySQL Users.
- Under Add New User, create a username and strong password.
- Use the Password Generator and save it in a password manager.
- Click Create User.
Do not reuse passwords
Reused database credentials are a top cause of account compromise. Treat DB passwords as production secrets.
Step 3: Assign the user to the database (permissions)¶
- Still in MySQL Databases, locate Add User to Database.
- Select the User and the Database you created.
- Click Add.
- Choose privileges.
Permission strategy that actually makes sense¶
- For WordPress and most CMS apps: select ALL PRIVILEGES
- For custom apps: use least privilege if you know what you’re doing
Common minimum set for many apps: - SELECT, INSERT, UPDATE, DELETE - CREATE, ALTER, INDEX, DROP - CREATE TEMPORARY TABLES - LOCK TABLES
Avoid unless explicitly required: - GRANT (rarely needed, increases blast radius)
Click Make Changes to apply.
Step 4: Find your database connection details¶
Most apps will ask for: - Database name - Database username - Database password - Database host
On most cPanel hosting setups, DB_HOST is localhost.
Example for WordPress (wp-config.php):
define('DB_NAME', 'gozenuser_wpdb');
define('DB_USER', 'gozenuser_wpuser');
define('DB_PASSWORD', 'YOUR_STRONG_PASSWORD');
define('DB_HOST', 'localhost');
Remote MySQL
If your app is outside the hosting server (external VPS/app), you may need Remote MySQL access. Open a ticket and specify the source IP and use case.
Using phpMyAdmin safely¶
phpMyAdmin is a web-based tool for managing databases. It is powerful and should be treated as admin-grade access.
Open phpMyAdmin¶
- In cPanel, open phpMyAdmin.
- On the left, select your database.
Common tasks¶
Import a database (.sql / .zip)
1. Select the database
2. Go to Import
3. Choose file
4. Click Go
Export a database
1. Select the database
2. Go to Export
3. Choose Quick or Custom
4. Download the file
Run a query
Use the SQL tab. Only execute commands you understand.
Do not run random SQL from the internet
Many “fix scripts” are destructive. If you are unsure, ask support or test on a staging copy first.
Security baseline¶
Do these. They pay off.
- Use unique DB user per website
- Never share one DB across multiple unrelated apps unless required
- Keep credentials in a password manager, not in notes or email
- Prefer HTTPS-only access to cPanel and phpMyAdmin
- Keep WordPress and plugins updated if applicable
- Maintain backups (database exports are not a backup strategy, they are a tool)
Related: - Secure your account with 2FA
Troubleshooting¶
“Access denied for user…”¶
Most common causes: - Wrong password - User not assigned to the database - Privileges not applied
Fix: - Re-check Add User to Database - Re-apply privileges and save
“Unknown database”¶
- Database name mismatch (including the prefix)
- App configured with a typo
Fix: - Copy the DB name directly from MySQL Databases
Import fails or times out¶
- File too large
- Script timeouts
Fix:
- Try a compressed import (.zip)
- Split the dump
- For large migrations, ask GOZEN HOST support for the best path
Summary¶
- Create Database
- Create User
- Assign User to Database with correct privileges
- Manage safely with phpMyAdmin
- Apply security: isolation, strong secrets, and least privilege when appropriate