Most of the time you’ll never touch your database directly — WordPress, your CMS, or your app handles all the SQL for you. But once or twice a year, you’ll need phpMyAdmin: fixing a corrupted setting, importing a database after a migration, running a one-off cleanup query, or recovering a forgotten admin password. This guide covers the database tasks that come up in practice.
Creating a database
cPanel → Databases → MySQL Databases. Two steps:
- Create the database. Top of the page — enter a name (gets prefixed with your cPanel username, e.g.
youruser_wpsite). Click Create Database. - Create a user. Scroll to “Add New User” — pick a username, generate a strong password (use the password generator). Click Create User.
- Link them. Scroll to “Add User To Database”. Select your user and your database, click Add. On the privileges page, check ALL PRIVILEGES for standard app usage, click Make Changes.
Save the database name, username, and password to your password manager. You’ll need all three when configuring WordPress (or any app) to use it.
Opening phpMyAdmin
cPanel → Databases → phpMyAdmin. Single click — you’re logged in via cPanel SSO, no separate credentials. The left sidebar lists every database your account owns; click any to expand its tables.
Top tabs you’ll use:
- Structure — list of tables in the current database.
- SQL — run raw SQL queries.
- Export — download the database as a SQL file.
- Import — upload a SQL file to restore.
- Operations — rename database, change collation, drop database.
Exporting a database (backup)
- Click the database in the left sidebar.
- Click the Export tab at the top.
- Method: Quick for typical use, Custom if you want to exclude specific tables.
- Format: SQL.
- Click Go. The browser downloads a
.sqlfile.
For very large databases (500+ MB), the browser export may timeout. In that case, use cPanel → JetBackup 5 → Database Backups → Download instead — server-side export with no timeout.
Importing a database
- Create an empty target database first (see “Creating a database” above).
- Click the new database in phpMyAdmin sidebar.
- Click Import tab.
- Choose your
.sqlfile. Format auto-detects. - Click Go.
If the import file is over ~50 MB, you’ll hit phpMyAdmin’s upload limit. Workarounds:
- Compress the SQL to
.gzfirst — phpMyAdmin handles compressed imports natively, and the file size drops dramatically. - Upload to your home directory via File Manager, then use SSH/cron to run
mysql -u user -p database < file.sql. - Use JetBackup’s restore feature for a full database.
Common WordPress database tasks
Reset your WordPress admin password
When you can’t log in and the email password reset isn’t working:
- Open phpMyAdmin, click your WordPress database.
- Click the
wp_userstable (or whatever prefix you used — could beiwv_users). - Find your user, click Edit.
- In the
user_passfield, type a new password. - From the Function dropdown next to it, select
MD5. - Click Go at the bottom.
WordPress will accept the MD5 hash for one login, then re-hash it to its newer bcrypt format on the next save.
Change your WordPress site URL
Useful after a domain change or migration where you can’t access WP admin:
- Open the
wp_optionstable. - Find the
siteurlrow → Edit → change tohttps://newdomain.com→ Go. - Find the
homerow → Edit → change to same value → Go.
This only changes WordPress’s URLs — content URLs embedded in posts (image src, internal links) still reference the old domain. For a full URL change use a search-replace plugin AFTER restoring access.
Disable all plugins (when site is white-screening)
When a plugin update breaks your admin and you can’t log in:
- Open
wp_options. - Find the
active_pluginsrow → Edit. - Change
option_valueto:a:0:{} - Go.
All plugins are deactivated. Site comes back, you log in, then re-enable plugins one at a time to find the culprit.
Switch to a default theme (when current theme is broken)
- Open
wp_options. - Find
templateandstylesheetrows. - Change both values to a known-installed default theme like
twentytwentythreeortwentytwentyfour.
Optimizing tables
Over time, tables accumulate “overhead” — wasted space from deleted/updated rows. Periodically optimize them:
- Click your database.
- Click Check All at the bottom of the table list.
- From the dropdown, choose Optimize table.
- Click. phpMyAdmin runs OPTIMIZE TABLE on each.
Speeds up queries slightly, reclaims disk. Worth running quarterly or after large data deletions.
Common database issues
“Error establishing a database connection” in WordPress. Credentials in wp-config.php don’t match. Double-check name (with prefix), user, password. Verify the user has been added to the database in MySQL Databases.
“Access denied for user”. User exists but isn’t linked to the database. Go to MySQL Databases → Add User to Database → confirm “All Privileges” is checked.
Database is huge and slowing the site. Find the largest tables: phpMyAdmin → click database → scroll to bottom to see total size, sort by size. Common bloat: wp_options (rogue transients), wp_postmeta (orphaned meta from deleted posts), spam/revision-laden wp_posts. Plugins like WP-Optimize or WP-Sweep clean these up safely.
Migrated database but site has the old domain in URLs. Use Search-Replace plugin (or the standalone wp-cli search-replace command, or interconnectit’s Search-Replace tool). Never use phpMyAdmin’s Find and Replace for serialized data — it corrupts it. Use a real WordPress-aware search-replace tool.
Import fails with timeout. File too large. Gzip the SQL or import via SSH.
What’s next
- Automated database backups: JetBackup 5 guide.
- Cron jobs for nightly DB exports: Cron jobs in cPanel.
- WordPress security after a database edit: Hardening checklist.
Always back up before editing — it’s a 30-second JetBackup snapshot. The number-one cause of “now I’ve made it worse” is editing the database with no fallback. Backup first; experiment second.
Was this helpful?
Thanks for your feedback!