Guide · Database connection error
"Error establishing a database connection" after a restore: the four-line fix
The site moved, and now every page shows one line of text. WordPress cannot log in to its database, almost always because wp-config.php still has the old host’s details. Here is how to fix it in five minutes.
- The fix first, then the shortcut
- Works on shared hosting
- Pay once, use it forever
After moving to a new host
Error establishing a database connection
Shown on every page after the move.
DB_HOST: 'old-server-db' · new host expects 'localhost'Site back online
Restored into the new host's own database settings.
The usual cause: database details from the old host.
The difference
Moving by hand vs restoring into a working install
Manual move
- 1Copy files, including the old wp-config.php
- 2Import the database under a new name
- 3Forget to update one of four settings
- 4Site down until someone finds it
Downtime until fixed
With Quick Restore
- Install WordPress on the new host first
- Restore the backup into it
- The new host's database details stay in place
- Site up on the first try
No connection errors
How it works
Fix it in three steps
1
Open wp-config.php
In the hosting file manager, in the folder where WordPress is installed.
2
Check four lines
DB_NAME, DB_USER, DB_PASSWORD and DB_HOST must match the new host’s database.
3
Test and repair
Reload the site. If it still fails, check the database user’s permissions.
Why Quick Restore moves avoid this error
Your new wp-config stays
You restore into a working WordPress install, so its database settings are kept.
Table prefix handled
A different prefix on the new site is dealt with during the restore.
URLs rewritten
The new address is applied safely, including serialized data.
Any host
Chunked upload works inside every host’s limits.
Checked first
The backup is validated before the database is replaced.
Free to start
Free up to 512 MB; Pro for any size.
One payment. Yours to keep.
No monthly fee. 12 months of updates included, and the plugin keeps working after that.
You save $16 today
Pay once. Use it forever. No monthly or yearly fees.
- Restore backups of any size
- Back up files over 200 MB
- Import .wpress files of any size
- Chunked upload past host limits
- Validation before every restore
- Priority email support
Secure checkout by Razorpay · Licence key by email in about a minute
Full-site backups and restores up to 512 MB. Upgrade later and keep every backup.
Download free from WordPress.orgEverything in Pro plus daily, weekly or monthly backups that run on their own.
See Pro PlusCompare every Quick Restore plan · Need several sites? Contact us
Not sure which plan? Compare them
The features that matter most, plan by plan. Every paid plan is one payment with 12 months of updates.
| Quick RestoreChoose the plan that fits | FreeFreeDownload free | Moves sites of any sizePro Original price was: $39.$23Current price is: $23.Buy Pro | Pro Plus Original price was: $59.$35Current price is: $35.Buy Pro Plus | Max Original price was: $199.$119Current price is: $119.Buy Max |
|---|---|---|---|---|
| Full-site backup to .wpqr (database, media, plugins, themes) | ||||
| Back up single files larger than 200 MB (videos, large archives) | ||||
| Maximum restore size | 512 MB | Unlimited | Unlimited | Unlimited |
| Chunked upload (bypasses host upload limits) | ||||
| Backup validation before restore | ||||
| Serialization-safe URL replacement (new domain) | ||||
| Import All-in-One WP Migration .wpress files | ||||
| One-click restore from a backup saved on the server | ||||
| Scheduled automatic backups (daily / weekly / monthly / custom) | ||||
| Retention rules (keep the latest N scheduled backups) | ||||
| Email a download link when a scheduled backup completes | ||||
| WordPress installations covered | 1 | 1 | 1 | 5 |
| Updates included | Free forever | 12 months | 12 months | 12 months |
| Licence key by email in about a minute. | Download free | Buy Pro | Buy Pro Plus | Buy Max |
The fix
Fixing the database connection, step by step
- Find the new database details. In the hosting panel, under MySQL Databases: database name, user, password and host (often
localhost, but some hosts use a hostname). - Edit wp-config.php. Update
DB_NAME,DB_USER,DB_PASSWORDandDB_HOSTto those values. Copy and paste the password: one wrong character is enough. - Check the user is attached to the database. Many panels need you to add the user to the database with All Privileges. A user that exists but is not attached gives the same error.
- Check the table prefix. If
$table_prefixin wp-config.php does not match the imported tables (for examplewp_vswpx7_), WordPress will offer to install fresh instead. Set it to match. - Make sure the database was imported. Open phpMyAdmin: if the database is empty, the import failed and needs to be run again.
Still failing on a site that worked yesterday, without a move? The database server may be down: ask your host. Other post-move problems are in WordPress restore errors, fixed.
Watch
Watch a site restored to a new host
Questions about database connection errors
Yes. You pay once and can use Quick Restore forever, with no monthly or yearly fees. 12 months of updates and support are included; after that, renewing is optional, and the plugin keeps working either way.
No. You are only telling WordPress how to reach the database; nothing in it changes.
Usually localhost. Some hosts use a separate database server name; it is shown in the hosting panel next to the database.
No. You restore into a working WordPress install, so its database settings stay as they are.
Only if the new WordPress install itself cannot reach its database, and then it would show before you restore.
Yes. Pro, Pro Plus and Max are add-ons to the free Poly Bright Quick Restore plugin from WordPress.org. If the free plugin is missing, the add-on offers to install it in one click.
The plugin keeps working. Renew only if you want another year of new features and fixes. There is no subscription to cancel.
Next time, move without touching wp-config.php
Install WordPress, restore one file, done.
You save $16 today
Pay once. Use it forever. No monthly or yearly fees.
- Restore backups of any size
- Back up files over 200 MB
- Import .wpress files of any size
- Chunked upload past host limits
- Validation before every restore
- Priority email support
Secure checkout by Razorpay · Licence key by email in about a minute
Full-site backups and restores up to 512 MB. Upgrade later and keep every backup.
Download free from WordPress.orgEverything in Pro plus daily, weekly or monthly backups that run on their own.
See Pro PlusCompare every Quick Restore plan · Need several sites? Contact us
More guides
- All-in-One WP Migration maximum upload file size and import errors, fixed
- Back up WordPress before changing the PHP version, and how to switch safely
- Best WordPress backup plugin in 2026: honest picks for every kind of site
- How to backup a WordPress site without a plugin (and restore it)
- How to change the WordPress site URL in the database (safely)
- How to download a WordPress backup to your computer
- How to migrate a WooCommerce store to a new host without losing orders
- How to move WordPress to a new host without downtime