"Error establishing database connection" The message indicates that WordPress could not reach the database MySQL where the contents are stored. The cause is usually one of four places: incorrect information in wp-config.php, a downed database server, corrupted tables, or an expired hosting quota. Your content will not be lost with this error; When you check in the correct order, the site often comes back quickly.

Is the fault only on the front side or on the panel as well?

First check, alanadiniz.com/wp-admin is to open the address. If a different message appears on the panel, for example "Your database needs to be repaired", the problem is not with the connection but with corrupted tables. If there is the same error on both sides, the connection information or server side is checked.

Verify wp-config.php information

This error occurs frequently after the hosting password is changed, the site is moved, or the database user is recreated. There are four lines in the wp-config.php file:

define( 'DB_NAME', 'veritabani_adi' );
define( 'DB_USER', 'kullanici_adi' );
define( 'DB_PASSWORD', 'sifre' );
define( 'DB_HOST', 'localhost' );

DB_NAME is the name of the database, DB_USER and DB_PASSWORD are the information of the authorized user of that database. DB_HOST is localhost in most hostings; Some companies give a separate server name. Compare these values ​​with the MySQL section in the hosting panel. Also check that the user has been added to the database with "full privileges".

Is the database server running?

If the information is correct, try logging into phpMyAdmin. If phpMyAdmin also cannot connect, the MySQL service is either stopped or under overload. In shared hosting, this situation usually requires the intervention of the company. On your own server, the service is restarted and a "Too many connections" or disk full warning is searched in the logs.

Repair corrupt tables

If the panel wants repair, temporarily add the following line to the wp-config.php file: define( 'WP_ALLOW_REPAIR', true );. Behind alanadiniz.com/wp-admin/maint/repair.php Click the "Repair database" button at . Be sure to delete the row when the process is finished, because this page is public without requiring a login.

control order

OrderControlIf the result is like this
1Does wp-admin give different messages?Proceed to table repair
2Is the wp-config information the same as the panel?If different, correct it, the site will open
3Is phpMyAdmin opening?If it doesn't open, write to hosting support.
4Is the disk or connection quota full?Quota increase or cleanup

If the error repeats

An error occurring several times a week indicates a persistent resource problem. Bot traffic, heavy plugin queries or low connection limit are the most common reasons. For example, an e-commerce site whose traffic increased tenfold during the campaign period may rely on the connection limit of the shared server and show this message to visitors. In such a case, caching, bot blocking and a stronger server are taken together when necessary. For server side settings server optimisation page.

Why does this error occur after site migration?

The database name, username and server address almost always change when the site is moved to a new hosting. If the files are copied and wp-config.php is left with old information, the site will give this error. During migration, before importing the database, an empty database is created, the user is added to this database with all permissions and the information is written to the wp-config.php file. If the import was interrupted, the tables remain incomplete; In this case, check the existence of wp_options and wp_posts tables in phpMyAdmin.

Table prefix is ​​also a frequently overlooked detail. Table names on the old site for example wp7_ in wp-config.php if it starts with $table_prefix The value should also be the same. If the prefix is ​​different, WordPress cannot find the tables and shows the setup screen or connection error.

Common mistakes

  • Leaving the repair line in wp-config.php: The repair page remains public.
  • Changing a table without taking a backup: The database must be exported before each intervention.
  • Changing the password only on the panel: The new password should also be written to the wp-config.php file.

For backup methods WordPress backup Read our guide. If the site still does not open WordPress technical support Our team solves the connection problem at the source.

If the error occurs only sometimes, what is the reason?

An intermittent error often indicates that the server has hit its concurrent connection limit or that the MySQL service has restarted under load.

Does database repair cause data loss?

Repair fixes the corrupted table structure, but does not delete the contents. However, a database backup should be taken before the process.

What should I ask the hosting company?

Ask if the MySQL service is running and whether your account is running out of connection or disk quota.