BLACK FRIDAY40% OFF every Poly Bright plugin · pay once, use it foreverEnds Dec 4Grab the deal →
Skip to content

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

The difference

Moving by hand vs restoring into a working install

Manual move

  1. 1Copy files, including the old wp-config.php
  2. 2Import the database under a new name
  3. 3Forget to update one of four settings
  4. 4Site down until someone finds it

Downtime until fixed

No wp-config edits

With Quick Restore

  1. Install WordPress on the new host first
  2. Restore the backup into it
  3. The new host's database details stay in place
  4. 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.

Moves sites of any size
Quick Restore Pro
$39$23 lifetime licence
You save $16 today

Pay once. Use it forever. No monthly or yearly fees.

1 website · 12 months of updates included, renewal optional

  • 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
Buy Pro · $23

Secure checkout by Razorpay · Licence key by email in about a minute

Not ready yet?Quick Restore, free

Full-site backups and restores up to 512 MB. Upgrade later and keep every backup.

Download free from WordPress.org
Need more?Pro Plus · $35 one-time

Everything in Pro plus daily, weekly or monthly backups that run on their own.

See Pro Plus

Compare 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.

Not sure which plan? Compare them
Quick RestoreChoose the plan that fitsFreeFreeForever, on WordPress.orgDownload freeMoves sites of any sizePro Original price was: $39.Current price is: $23.one-time · 1 siteBuy ProPro Plus Original price was: $59.Current price is: $35.one-time · 1 siteBuy Pro PlusMax Original price was: $199.Current price is: $119.one-time · 5 sitesBuy Max
Full-site backup to .wpqr (database, media, plugins, themes)
Back up single files larger than 200 MB (videos, large archives)
Maximum restore size512 MBUnlimitedUnlimitedUnlimited
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 covered1115
Updates includedFree forever12 months12 months12 months
Licence key by email in about a minute.Download freeBuy ProBuy Pro PlusBuy Max

See every feature, plan by plan →

The fix

Fixing the database connection, step by step

  1. 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).
  2. Edit wp-config.php. Update DB_NAME, DB_USER, DB_PASSWORD and DB_HOST to those values. Copy and paste the password: one wrong character is enough.
  3. 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.
  4. Check the table prefix. If $table_prefix in wp-config.php does not match the imported tables (for example wp_ vs wpx7_), WordPress will offer to install fresh instead. Set it to match.
  5. 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.

Moves sites of any size
Quick Restore Pro
$39$23 lifetime licence
You save $16 today

Pay once. Use it forever. No monthly or yearly fees.

1 website · 12 months of updates included, renewal optional

  • 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
Buy Pro · $23

Secure checkout by Razorpay · Licence key by email in about a minute

Not ready yet?Quick Restore, free

Full-site backups and restores up to 512 MB. Upgrade later and keep every backup.

Download free from WordPress.org
Need more?Pro Plus · $35 one-time

Everything in Pro plus daily, weekly or monthly backups that run on their own.

See Pro Plus

Compare every Quick Restore plan · Need several sites? Contact us

Pro · $23One-time payment
Buy now