Ошибка error establishing a database connection wordpress

If you are encountering a WordPress error message or white screen, don’t panic. Someone has likely encountered the same message before and it can easily be solved.

This page lists the most common WordPress errors experienced by WordPress users, and provides a starting point for fixing them. At WordPress Support, you will also find links to more detailed pages or forums where a volunteer will be there to help.

The White Screen of Death

Both PHP errors and database errors can manifest as a white screen, a blank screen with no information, commonly known in the WordPress community as the WordPress White Screen of Death (WSOD).

Before resorting to desperate measures, there are a number of reasons for the WordPress white screen of death:

  • A Plugin is causing compatibility issues. If you can access the Administration Screens try deactivating all of your Plugins and then reactivating them one by one. If you are unable to access your Screens, log in to your website via FTP. Locate the folder wp-content/plugins and rename the Plugin folder plugins_old. This will deactivate all of your Plugins. You can read more about manually deactivating your plugins in the Troubleshooting FAQ.
  • Your Theme may be causing the problem. This is especially likely if you are experiencing the white screen of death after you have just activated a new Theme, or created a New Site in a WordPress Network. Log in to the WordPress Administration Screens and activate a default WordPress Theme (e.g. Twenty Twenty-One). If you are using WordPress 5.8 and below, please switch to Twenty Twenty-One theme since the Twenty Twenty-Two theme requires 5.9 and above. If you can’t access your Administration Screens, access your website via FTP and navigate to the /wp-content/themes/ folder. Rename the folder for the active Theme.

The WP_DEBUG feature often provides additional information.

Internal Server Error

Internal Server Error message

There can be a number of reasons for an Internal Server Error. Here are some thing you can do to solve it:

  • The most likely issue is a corrupted .htaccess file. Log in to your site root using FTP and rename your .htaccess file to .htaccess_old. Try loading your site to see if this has solved your problem. If it works, make sure to visit Settings > Permalinks and reset your permalinks. This will generate a new .htaccess file for you.
  • Try deactivating all of your Plugins to see if it is a Plugin issue. If you are unable to access your WordPress Administration Screens, deactivate your Plugins via FTP by following these instructions.
  • Switch the Theme to a WordPress default Theme (e.g. Twenty Twenty-One) to eliminate any Theme-related problems. If you are using WordPress 5.8 and below, please switch to Twenty Twenty-One theme since the Twenty Twenty-Two theme requires 5.9 and above.
  • Increase the PHP Memory limit
  • Try re-uploading the wp-admin and wp-includes folders from a fresh install of WordPress.

Error Establishing Database Connection

If you get a page featuring the message “Error Establishing Database Connection,” this means that there is a problem with the connection to your database and there could be a number of reasons for this. The following are possible reasons and solutions.

Incorrect wp-config.php Information

“Error establishing a database connection” is usually caused by an error in your wp-config.php file. Access your site in your FTP client. Open up wp-config.php and ensure that the following are correct:

  • Database name
  • Database username
  • Database password
  • Database host

Learn more about editing wp-config.php.

If you are sure your configuration is correct you could try resetting your MySQL password manually.

Problems with Your Web Host

The next step is to contact your web host. The following hosting issues may be causing the problem:

  • Your database has met its quota and has been shut down.
  • The server is down.

Contact your hosting provider to see if either of these issues is causing your problem.

Compromised Website

If you have checked wp-config.php for errors, and confirmed with your host for hosting issues, it is possible that your site has been hacked.

Scan your site with Sucuri SiteCheck to ensure that it hasn’t been compromised. If it has you should check out My Site was Hacked.

Failed Auto-Upgrade

There will be situations when the WordPress auto-update feature fails. Symptoms include:

  • A blank white screen and no information.
  • A warning that the update failed.
  • A PHP error message.

The WordPress automatic upgrade feature may fail due to a glitch in the connection with the main WordPress files, a problem with your Internet connection during upgrade, or incorrect File Permissions

To update your WordPress site manually, see the Manual Update article.

Connection Timed Out

The connection timed out error appears when your website is trying to do more than your server can manage. It is particularly common on shared hosting where your memory limit is restricted. Here are some things you can try:

  • Deactivate all Plugins. If deactivating all the WordPress Plugins on your site resolves the issue, reactivate them one-by-one to see which plugin is causing the problem. If you are unable to access your Administration Screens, read about how to manually deactivate your plugins.
  • Switch to a default WordPress Theme. If you are using WordPress 5.8 and below, please switch to Twenty Twenty-One theme since the Twenty Twenty-Two theme requires 5.9 and above. This should rule out any Theme-related problems.
  • Increase your memory limit in wp-config.php. If you are on shared hosting you may have to ask your hosting provider to increase your memory limit for you.
  • Increase the maximum execution time in your php.ini file. This is not a WordPress core file so if you are not sure how to edit it, contact your hosting provider to ask them to increase your maximum execution time. See below instructions for increasing maximum execution time.

Maintenance Mode Following Upgrade

When WordPress updates, it automatically installs a .maintenance file. Following upgrade, you may receive a message that says “Briefly unavailable for scheduled maintenance. Please check back in a minute.” The maintenance file may not have been removed properly.

To remove this message do the following:

  1. Log in to your website using your FTP program
  2. Delete the .maintenance file, which will be found in your site root.

Read more about the maintenance mode issue.

You Make Changes and Nothing Happens

If you are making changes to your website and you do not see the changes in your browser, you may need to clear your browser cache. Your browser stores information about the websites that you visit. This makes it faster to load websites when you visit them because the browser just has to reload information already stored on your computer, rather than downloading it again.

If you make a change to a website and the browser does not think it is significant, it will simply load the data from your cache, and you won’t see your changes. To fix the problem, simply empty your browser cache or close the tab and reopen the link.

Pretty Permalinks 404 and Images not Working

If you are experiencing 404 errors with pretty permalinks and a white screen when you upload images, mod_rewrite may not be enabled in Apache by default. Mod_rewrite is an extension module of the Apache web server software which allows for “rewriting” of URLs on-the-fly. It’s what you need to make pretty permalinks work.

WordPress Multisite networks usually experience this but it can also occur on shared hosting providers or after a site migration or server move.

Reset your permalinks through Settings > Permalinks. If this does not work, you may have to edit the .htaccess file manually.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If you are not familiar with editing your .htaccess file, contact your hosting provider to ask them to turn on mod_rewrite rules. There is more information on pretty permalinks in the WordPress Codex.

Custom Post Type 404 Errors

You may experience problems with 404 errors and custom post types. Try the following steps:

  1. Make sure that none of your Custom Post Types and single pages have the same name. If they do, rename the single page, including the slug.
  2. Log in to your WordPress Administration Screens, navigate to Settings > Permalinks. Select the default permalinks. Save. Then reselect your preferred permalinks. This will flush the rewrite rules and should solve your problem.

Specific Error Messages

There are a number of different errors that will appear in your error logs. To access your error logs you will need to turn on debugging and then locate your error log via FTP. The following information will help you to decipher some of the common error messages.

PHP Errors

Below are some common PHP error messages.

Fatal Errors and Warnings

If you receive a warning that WordPress cannot modify header information and headers are already sent, it usually means that you have spaces or characters before the opening tags or after the closing tags. Read how to fix the headers already sent error.

If you are experiencing this problem when you have just installed WordPress you may have introduced a syntax error into wp-config.php. These instructions will help you to fix the error.

Call to undefined function

An error reading call to undefined function could mean that a WordPress Plugin is trying to find a file or data which isn’t present or accessible in the code. Reasons for this include:

  • An error when trying to auto-install or auto-upgrade a Plugin. Try installing or upgrading the Plugin manually.
  • An error when trying to auto-install or auto-upgrade a Theme. Try installing or upgrading the Theme manually.
  • You may be using an incompatible WordPress Plugin or incompatible Theme. This could happen with older versions of WordPress and a new WordPress Plugin, or if you are trying to use a WordPress Multisite Plugin on a single site installation. Upgrade WordPress to resolve this issue.
  • You may be trying to call a function that doesn’t exist. Check functions.php for misspellings.

Try deactivating the WordPress Plugin or changing the WordPress Theme that caused the error to appear. If you are unable to do this from within the Administration Screens, you may have to do this manually via FTP.

Allowed memory size exhausted

An Allowed Memory Size Exhausted error means that your WordPress installation doesn’t have enough memory to achieve what you want. You can try out the following steps:

  • Increase your memory limit in wp-config.php
  • Increase your memory limit by editing php.ini. This is not a file that comes with WordPress so if you are unfamiliar with it you should contact your web host about increasing your memory limit.
Maximum execution time exceeded

You may receive a message such as “Maximum execution time of 30 seconds exceeded” or “Maximum execution time of 60 seconds exceeded”. This means that it is taking to longer for a process to complete and it is timing out. There are a number of ways to fix this error.

Editing .htaccess

Make sure you back up .htaccess before you edit it.

Add the following line to .htaccess:

php_value max_execution_time 60

Editing php.ini

Add the following to php.ini

max_execution_time = 60

If you are unsure of how to make these changes, or if you are on shared hosting that prevents you from making them yourself, you should contact your hosting provider and ask them to increase your maximum execution time.

Parse errors

Syntax Error

A syntax error means that you have made a mistake while creating your PHP structure. You could, for example, be;

  • Missing a ; at the end of an individual line.
  • Using curly quotation marks.
  • Missing a curly bracket.

When this error appears it will tell you which file the error appears in (functions.php for example) and approximately which line (it may not always be the exact line so be sure to check just before and just after) in the code.

Unexpected

If you are receiving an error which says ‘parse error: unexpected’ this usually means that you have forgotten to include a character. The most common are:

  • Unexpected ‘=’ : you have forgotten to include the $ when referencing a variable
  • Unexpected ‘)’ : you have forgotten to include the opening bracket (
  • Unexpected ‘(‘ : you have forgotten to include the closing bracket )
  • Unexpected T_STRING: you have forgotten a quotation mark or a semi-colon at the end of the previous line
  • Unexpected T_ELSE: you have an else statement with no opening if statement

Use of an undefined constant

As with parse errors, “use of an undefined constant” means that you are missing a character. It could be one of the following:

  • Missing a $ when referencing a viariable
  • Missing quotation marks around array keys

Database Errors

The following errors may appear in relation to your WordPress database.

Error 13 – Cannot Create/Write to File

There are a number of reasons why you may be experiencing this error.

MySQL cannot create a temporary file. 

The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL. To verify this, enter MySQL at the command line and type show variables. You’ll get a long list and one of them will read: tmpdir = /somedir/ (whatever your setting is.)

To solve this, alter the tmpdir variable to point to a writable directory.

  1. Find the my.cnf file. On *nix systems this is usually in /etc/. On Windows system, Find the my.ini.
  2. Once found, open this in a simple text editor and find the [mysqld] section.
  3. Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try /var/tmp or /usr/tmp. On Windows, use C:/Windows/tmp.
  4. Save the file.
  5. Shutdown MySQL by typing mysqlshutdown -u -p shutdown.
  6. Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in /usr/local or sometimes in /usr/ on Linux systems.

The file permissions are incorrect

Correct the File Permissions.

If none of this make sense and you have someone to administrate your system for you, show the above to them and they should be able to figure it out.

CREATE Command Denied to User

This error occurs when the user assigned to the database does not have adequate permissions to perform the action to create columns and tables in the database. You will need to log in to CPanel or Plesk to give your database user adequate permissions.

Alternatively you can create a new user to assign to your database. If you do create a new user you will need to ensure that it is updated in wp-config.php.

Error 28

It could be because:

  • you are out of space on /tmp (wherever tmpdir is), or,
  • you have too many files in /tmp (even if there is lots of free space), or,
  • Your cache on your server is full

This is a MySQL error and has nothing to do with WordPress directly; you should contact your host about it. Some users have reported that running a “repair table” command in phpMyAdmin fixed the problem.

Error 145

This indicates that a table in your database is damaged or corrupted. If you are comfortable using phpMyAdmin you can use these instructions on repairing your MySQL database tables.

Always backup your database before performing any actions on it.

If you have not used phpMyAdmin before, or are uncomfortable doing so, contact your web host and ask them to run CHECK/REPAIR on your database.

Unknown Column

An unknown column error can be caused by a missing column in the database. If you have just upgraded WordPress then try manually upgrading again. To update your WordPress site manually, see the Update article.

If you are running a database query when you encounter the error then you may by using incorrect quotation marks for the identifier quote character. This question on Stack Overflow provides more details. Also see the MySQL documentation.

Resources

  • MySQL Error Codes and Messages

Это – один из худших кошмаров для владельца веб-сайтов. Вы вводите URL-адрес вашего сайта… однако вас приветствует не ваша главная страница, а нечто другое. Вместо этого вы видите пустой экран. Вне зависимости от того, по какой ссылке вы перешли, вас встречают зловещие слова «Error establishing a database connection».

error-establishing

Чем дольше ваш сайт будет лежать, тем больше трафика вы потеряете. А это означает потерянных подписчиков, клиентов, а также упущенный доход. Однако что вообще привело к такой ошибке? Что она означает? И, что самое важное, как исправить ее, чтобы вернуть свой сайт в нормальное состояние как можно быстрее?

В этой статье мы расскажем вам, что означает это сообщение об ошибке, что может вызывать его, а также посмотрим, как найти корень зла и исправить его.

Содержание

  1. Что означает «Error Establishing a Database Connection»?
  2. Что приводит к этой ошибке?
  3. Решение проблем с «Error Establishing a Database Connection»
  4. 1. Определяем, с чем произошла ошибка.
  5. 2. Проверяем учетные данные БД в wp-config
  6. 3.Все еще появляется ошибка?

Что означает «Error Establishing a Database Connection»?

Для начала давайте посмотрим на то, как WordPress отображает ваш сайт, и тогда станет ясно, почему эта ошибка настолько разрушительная. WordPress написан на PHP и MySQL. Вся информацию, которая составляет ваш сайт, хранится в базе данных MySQL, а PHP используется в WordPress для сохранения и получения этой информации из базы данных.

В целом, всякий раз, когда страница загружается на вашем сайте, она создается «на лету». Код PHP используется для того, чтобы получить доступ к базе данных MySQL и получить всю информацию, которая требуется для создания страницы. Одни PHP-запросы получают заголовок записи, другие – захватывают имя автора, третьи – берут дату публикации и т.д.

Вернемся к нашему сообщению об ошибке: «Error establishing a database connection». Оно означает, что по каким-то причинам PHP-код не смог соединиться с базой данной MySQL, чтобы получить информацию, которая требовалась для создания страницы.

Именно по этой причине на экране с ошибкой красуется лишь одно сообщение. Если вы не можете подключиться к базе данных, вы не знаете, что выводить на экран; нет никакой доступной информации о вашем сайте.

Что приводит к этой ошибке?

В то время как само сообщение об ошибке является достаточно ясным, причины, отвечающие за его появление, зачастую не совсем понятны.

Есть много разных причин, почему ваш сайт может иметь проблемы с подключением к вашей базе данных, однако их обычно можно разбить по трем категориям:

  1. Ваши учетные данные для входа в БД являются неверными. Ваша база данных использует отдельный логин и пароль. Если эти данные были недавно изменены, ваш сайт не сможет подключиться к БД, используя старые учетные данные.
  2. Ваша база данных была повреждена. Привести к такому печальному исходу могут самые разные причины, начиная с установки некачественного плагина и заканчивая ударом молнии в сервер (правда, это не самый распространенный вариант).
  3. Сервер, на котором расположена ваша БД, в данный момент не работает. Сервер с вашей базой данных может выйти из строя из-за каких-либо проблем или ошибок на стороне хостинг-компании. Также он может «лежать» из-за того, что на ваш сайт обрушился большой поток трафика, который сервер просто не смог обработать.

Таким образом, учитывая все возможные ситуации, как мы можем справиться с возникшей проблемой?

Решение проблем с «Error Establishing a Database Connection»

1. Определяем, с чем произошла ошибка.

Появляется ли эта ошибка только при обращении к wp-admin или же ваш сайт полностью лежит? А может, у вас другая ситуация: ваш сайт не работает, но при попытке входа вы видите несколько иную ошибку: «One or more database tables are unavailable. The database may need to be repaired»?

Все это говорит о том, что ваша база данных была повреждена.

WordPress обладает встроенным методом восстановления базы данных, однако для начала вам нужно будет включить эту возможность. Чтобы сделать это, вы должны иметь доступ к wp-config.php, который содержит ваши параметры и конфигурацию сборки WordPress.

Вы можете найти wp-config в корневой папке вашей сборки WordPress. Получить к ней доступ можно через cPanel: выберите File Manager и перейдите к папке, в которой у вас установлен WordPress.

Как только вы откроете wp-config, добавьте к нему следующую строку в самый конец файла:

define( 'WP_ALLOW_REPAIR', true );

Эта строка позволит вам оптимизировать и восстановить вашу базу данных. Перейдите по ссылке: www.yourwebsite.com/wp-admin/maint/repair.php (вместо yourwebsite.com введите реальный URL-адрес).

wordpress-database-repair

Вы должны увидеть страницу, показанную выше, с двумя возможностями восстановления – «repair» и «repair and optimize». Учтите, что оптимизация займет дополнительное время.

Обратите внимание, что страница восстановления базы данных никак не защищена; любой может получить доступ к этой странице по одному лишь URL. Как только вы восстановите вашу базу данных, обязательно удалите строку, добавленную ранее, из файла wp-config. В итоге вы ограничите доступ к этой странице.

Если ошибка пропала, вы можете закрыть wp-config и вернуться к нормальной работе с сайтом.

Если все это вам не помогло, давайте перейдем ко второму этапу восстановления сайта.

2. Проверяем учетные данные БД в wp-config

Если первый шаг не помог вам, то в таком случае вам нужно проверить, корректно ли заданы параметры базы данных в файле wp-config.

Удивлены, каким образом ваши учетные данные, работавшие ранее, перестали это делать? Смена хостинг-компании, изменение имени БД или пользовательской информации может привести к тому, что ваш wp-config файл будет содержать старые данные.

У вас может быть по-прежнему открыт файл wp-config, оставшийся еще с прошлого шага. В противном случайте войдите в cPanel хостинга и откройте File Manager. Перейдите к папке, в которую вы устанавливали WordPress, и найдите в ней файл, названный wp-config.php. Откройте его для редактирования.

Вы увидите учетные данные для вашей базы данных – обычно они расположены в самом верху файла. Выглядят они обычно следующим образом:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
 
/** MySQL database username */
define( 'DB_USER', 'username_here' );
 
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
 
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

Как вы можете видеть, здесь есть несколько информационных разделов, которые требуются WordPress для доступа к вашей БД:

  1. Название БД (DB_NAME)
  2. Логин для входа (DB_USER)
  3. Пароль для входа (DB_PASSWORD)
  4. Хост базы данных (DB_HOST)

Если какое-либо из этих значений будет некорректным, WordPress не сможет подключиться к базе данных.

Проверить базу данных вне WordPress можно при помощи PHPMyAdmin – инструмента, который используется для редактирования базы данных MySQL. PHPMyAdmin включен во многие тарифные планы хостингов, и вы можете найти его в консоли cPanel.

Предупреждение: Будьте аккуратны при работе с PHPMyAdmin, поскольку этот инструмент ведет прямую работу с базой данных.

Как только вы войдете в PHPMyAdmin, вы увидите список баз данных на вашем сервере. Щелкните по той из них, которая будет соответствовать названию БД в файле wp-config (значение DB_NAME).

Не видите ни одной базы данных? В таком случае обратитесь к вашему хостингу, поскольку, скорее всего, проблема связана с вашим сервером.

После щелчка по названию базы данных вы увидите основной экран, содержащий названия таблиц вашей БД. Чтобы убедиться в том, что это – корректная БД, вы можете найти таблицу под названием wp_options и щелкнуть по опции Browse рядом с ней. Вы должны увидеть название вашего сайта, URL, а также все основные настройки. Теперь вы знаете, ту ли базу данных вы открыли. Если нет, то настройте ее должным образом в wp-config.

Давайте теперь проверим логин и пароль.

Есть несколько способов проверить их. Я предложу вам два варианта.

  1. Вы можете создать простой .php файл для тестирования того, сможете ли вы подключиться к вашей базе данных с учетными данными из файла wp-config
  2. Вы можете создать нового пользователя с паролем, и обновить файл wp-config, внеся в него новую информацию. Делать это надо в том случае, если первый способ не сработал.

Вариант 1. Тестируем существующие учетные данные.

Создаем файл в каталоге WordPress – пусть он называется testconnection.php (название не важно, главное чтобы он имел расширение .php). Вставляем в него следующий код:

<?php
$testConnection = mysql_connect('localhost', 'root', 'password');
if (!$testConnection) {
die('Error: ' . mysql_error());
}
echo 'Database connection working!';
mysql_close($testConnection);
?>

Как только вы создадите этот файл, просто перейдите по соответствующему URL в браузере (к примеру, site.com/testconnection.php). Вы увидите либо сообщение об удачном соединении, либо ошибку с детальной информацией.

Если логин и пароль не работают, мы можем создать нового пользователя.

Вариант 2. Создаем нового пользователя для БД (новый логин и пароль).

Сделать это мы можем с помощью другого инструмента в cPanel, который называется MySQL® Databases. Переходим к нему, затем прокручиваем вниз до заголовка: MySQL Users: Add New User. Задаем имя пользователя, а также сложный пароль. Щелкаем — Create User. Теперь прокручиваем до заголовка Add User To Database, и выбираем ваше новое имя пользователя и вашу базу данных WordPress, после чего щелкаем по Add. Обновляем файл wp-config, введя в него ваше новое имя пользователя и пароль.

Теперь название вашей БД, имя пользователя и пароль являются корректными. Остался только DB_HOST.

В большинстве случаем значение DB_HOST должно быть localhost, однако это зависит от настроек вашего хостинга. В WordPress есть список значений DB_HOST для популярных хостингов. Если ваш хостинг не перечислен там, то в таком случае обратитесь к нему за уточнениями.

3.Все еще появляется ошибка?

Если вы выполнили все шаги, приведенные выше, и ваш сайт все равно не работает, то в таком случае проблема заключается в вашем хостинге. Обратитесь в службу поддержки вашего хостинга и предоставьте им всю информацию по возникшей ошибке, а также те действия, которые вы совершили, пытаясь эту ошибку исправить – все это позволит компании быстрее справиться с проблемой.

Источник: www.elegantthemes.com/blog

Most of the time, your website’s database will run quietly in the background, retrieving the requested information on demand. But if there’s a problem, you may encounter the following warning: “Error establishing a database connection.”

Fortunately, there are various ways to fix this common WordPress error. By working your way through these possible fixes, you can get your site back on track as quickly as possible.

In this post, we’ll discuss why your site may be struggling to connect to its underlying MySQL database. We’ll then share seven ways to fix the “Error establishing database connection” issue in WordPress. 

What the “Error establishing database connection” issue is (and why it occurs)

The “Error establishing database connection” error means that WordPress is unable to make a connection to the database.

WordPress stores all of your website data and content in a database. Every time someone visits your site, the Content Management System (CMS) connects to this database and retrieves the necessary information. When you encounter this error, it means that your site is inaccessible to everyone, including admins and site visitors. 

There are several reasons why WordPress could be struggling to make a connection. This issue may be caused by incorrect database information in your WordPress configuration file or corrupt files in your database. You might also encounter this message if the database server is down. 

Since there are various causes, there are also several solutions. This makes the database connection error notoriously tricky to troubleshoot.

How to fix the “Error establishing database connection” issue in WordPress

“Error establishing database connection” is one of the most common WordPress errors and it isn’t always easy to diagnose. In this troubleshooting guide, we’ll help you get to the root of the problem so you can get your site back on track. 

1. Check your database credentials

To connect to the database, WordPress needs the database name, username, password, and server. These credentials are stored in wp-config.php, which is your site’s configuration file. 

If any of this information is incorrect, then WordPress will be unable to connect to the database. To check these credentials, you’ll need to connect to your server using a File Transfer Protocol (FTP) client like FileZilla. 

After connecting to your site over FTP, you’ll need to locate your configuration file. You’ll usually find this in your website’s root directory, which is typically called public_html or is named after your site’s domain. Open this folder and look for a file called wp-config.php.

wp-config.php file via FTP

Then, control-click this file and select Open. FileZilla will launch it in your computer’s default text editor. 

The MySQL settings section contains the credentials that WordPress uses when attempting to access your database. To check whether this information is correct, you’ll need to log into your hosting panel. The location of this information will vary depending on your provider, but be on the lookout for any settings labeled Database or MySQL.

Then, check that the database name, username, password, and host match the information stored in your wp-config.php file. If there’s a discrepancy, you’ll need to update your configuration file.

In your FTP client, control-click the wp-config.php file and choose Download. Open this file for editing and update your database credentials. After making this change, you can re-upload the modified wp-config.php file by dragging it into FileZilla.

2. Check your database host information

Your MySQL hostname defines where your database is hosted. If you want to connect to your database, you’ll need to use the correct MySQL hostname. 

Most WordPress hosting companies use localhost, but some providers host their databases on separate servers. This is particularly true for managed WordPress hosts.

If you’ve verified that your database name, username, and password are correct, then it’s worth checking that you’re using the correct database location. This typically requires you to contact your hosting company.

Alternatively, you may be able to retrieve this information manually using the phpMyAdmin tool. If your provider supplies cPanel, then you can typically find phpMyAdmin by logging into your cPanel dashboard. Then, search for the phpMyAdmin option.

Inside phpMyAdmin, find the Database Server block. This displays information about your server setup, including its location. For example, if it lists your server as “LocalHost via UNIX socket,” then your server is located at localhost. 

To check this against your database credentials, connect to your site using FileZilla and open your wp-config.php file. You’ll find the MySQL hostname in the following section: 

/** MySQL hostname */

define( ‘DB_HOST’, ‘localhost’ );

If this is incorrect, then you can download the wp-config.php file to your local computer and update this information in any compatible text editor. Then, simply reupload the edited file to your server. WordPress should now be able to connect to your server at the correct location. 

3. Repair the database

Over time, the files in your database can become corrupted. Fortunately, WordPress includes a tool that promises to repair a scrambled database with the click of a button.

To enable this repair tool, download your wp-config.php file using FileZilla. You can then open it in a text editor and add the following line:

define('WP_ALLOW_REPAIR', true);

Now, save your changes and reupload the modified wp-config.php file to your server. Next, enter your site’s domain name and append the following: /wp-admin/maint/repair.php

For example, if your website is located at https://www.mysite.com, you’ll need to head over to https://www.mysite.com/wp-admin/maint/repair.php. This will launch WordPress’ built-in database repair tool. 

database repair wizard

You can now choose whether to repair or repair and optimize your database. Fine-tuning your database may improve your site’s performance, which can boost your position in search engine rankings. It’s also great for the overall visitor experience. 

With this in mind, we recommend that you select Repair and Optimize Database. WordPress will now attempt to repair your database and display a page of code once it completes the process. 

As we’ve just seen, accessing the database repair tool is as simple as appending wp-admin/maint/repair.php to your domain URL. This is a security risk, so it’s important to disable this tool as soon as you’ve performed your scan.

You can use FileZilla to open your wp-config.php file and remove the ‘WP_ALLOW_REPAIR’ line. Then, re-upload this modified file to your server. This will disable the database repair tool and close the potential security loophole. 

4. Check whether your database server is offline

Occasionally, your database server may go down. In particular, this might occur if your site experiences a period of heavy traffic.

You’re also at a greater risk of downtime if you’re using shared hosting or opted for budget-friendly hosting that offers limited resources. If your server is offline, WordPress will be unable to connect to your database and you’ll encounter an error. 

If you run multiple sites on the same server, it’s worth visiting all of these sites in your web browser. If they all display the same database error message, then you’ll know that this problem isn’t tied to a specific website. In this scenario, it’s likely that your database server is offline. 

Assuming that you’re running multiple sites on the same hosting account, you can also attempt to connect to your database via phpMyAdmin. If you encounter errors, or strange behavior inside this tool, then an unresponsive server may be to blame. 

If you suspect your database server is offline, then it’s a good idea to contact your hosting provider. Your web host may be able to give you a timeframe for when they expect to resolve this problem. They may even be completely unaware that your database is offline. 

If you have a dedicated server, local server, or Virtual Private Server (VPS), you can try rebooting your server manually. This process will vary depending on your setup and hosting provider, so you may need to check your web host’s documentation for more information. Alternatively, if you’re unsure how to restart your server, you can always contact your provider for assistance. 

5. Update your site URL

Some WordPress users have reportedly resolved this error by updating their WordPress site URL. You can make this change via the phpMyAdmin tool. 

After logging into the phpMyAdmin dashboard, select the database that’s causing problems. Then, select the SQL tab.

running an SQL query in phpMyAdmin

You’ll now need to enter the table name, which is displayed in the left-hand column of the phpMyAdmin dashboard. This is usually wp_options by default. 

wp_options table in phpMyAdmin

You can now enter the following MySQL query, being sure to replace MY_URL with the URL of your WordPress website. You’ll also need to change wp_options to your own table name:

UPDATE wp_options SET option_value='MY_URL' WHERE option_name='siteurl'

After running this query, try re-accessing your website. This may have resolved your database error. 

6. Check if your themes or plugins are corrupted

WordPress’ huge community of themes and plugins are one of the platform’s greatest strengths. Sadly, adding third-party code to your website can result in conflicts, errors, and other strange behavior. 

There’s also a chance that this code may become corrupted. In particular, if you’ve recently added some new software, run any updates, or manually edited your site’s code, then a theme or plugin may be causing the database error.

Fortunately, there’s an easy way to deactivate all of your themes and plugins. You can then test whether this resolves your database error. 

Using an FTP client like FileZilla, navigate to your wp-content folder. You can then control-click on the plugins directory and opt to rename it. You can use any title, as long as it’s not plugins (e.g. plugins.bak).

wp-content folder accessed via FTP

This will deactivate every plugin across your website. If this resolves the error, then you’ll know that third-party software is to blame. You can now rename this folder back to plugins in order to reactivate all of your plugins. 

In order to pinpoint the culprit, open this folder and rename each plugin in turn. As soon as the database error disappears, you’ll have successfully identified the plugin that’s causing so many problems. 

If deactivating every plugin doesn’t resolve the error, you can repeat this process with your themes directory. If neither of these tricks resolve the issue, then you’ll know that your third-party software isn’t contributing to your database issue. 

7. Restore default WordPress files

There’s a chance that the core WordPress files may become corrupted. In some cases, a hacker may attempt to break into your site by editing the WordPres code. Or you might edit some of the core files by accident. It’s even possible that a plugin may make some modifications to the WordPress code without your knowledge. 

If this is the case, you may be able to restore your database connection by reinstalling a fresh version of WordPress. The easiest method is to download a clean copy of WordPress core.

Then, unpack the archive and delete the wp-content folder. This is crucial, as it ensures that you’re not overriding all of your content with a completely empty directory. You’ll also want to back up your site to ensure that you don’t lose any valuable information.

When you’re ready, drag all of the fresh WordPress core files into your FTP client. When prompted, opt to override all of your previous files. 

You can now attempt to access your site. If this has resolved the error, then it’s wise to spend some time exploring your site. It’s possible that installing a fresh copy of WordPress may remove some of your site modifications or settings. In this case, you may need to customize the fresh install. 

How to avoid the “Error establishing database connection” issue in WordPress

While there’s no way to protect your site against all database connection errors, there are ways to minimize your chances of encountering this problem.

In some scenarios, you may need to contact your hosting provider for assistance. Here, it helps to have a web host who offers 24/7 customer support or fast response times. This can help you resolve the error and get your site back online fast. 

For this reason, it’s smart to invest in a quality hosting provider who can offer the expertise and quick turnaround times you need in the event of a database connection error. It’s also a good idea to opt for a provider who specializes in WordPress. These hosts often optimize their offerings for the WordPress platform, which can reduce your chances of encountering the database error.

It’s also smart to create regular backups. This ensures that you always have the option to restore an earlier version of your website. Depending on the nature of the database error, this may be enough to resolve the problem.

There are plenty of WordPress backup plugins to choose from, but Jetpack Backup can save up all of your content, including your database in real time. You can also access and restore backups even if your site is completely down.

restoring a site backup with Jetpack

If you’re out and about when you notice the database error message, you can restore a backup from your mobile device, using the Jetpack mobile app. Jetpack also creates redundant copies on multiple servers, so you can be confident that you can restore a working version of your site.

Fixing the WordPress “error establishing database connection” problem

If you can’t access your WordPress website, then neither can anyone else — including potential customers. Therefore, you’ll want to resolve the “Error establishing a database connection” issue right away. 

There are many reasons why your site may be struggling to connect to its database, but it’s always a good idea to check your database credentials, including your host information. WordPress also includes a built-in database repair tool, which can help restore corrupted database files.

If you do encounter this error message, then a recent backup can be a lifesaver. By installing Jetpack Backup on your website, you’ll always have the option to restore a working copy of your content. This includes a recent version of your WordPress database. 

This entry was posted in Learn. Bookmark the permalink.


Rob Pugh profile

Rob Pugh

Rob is the Marketing Lead for Jetpack. He has worked in marketing and product development for more than 15 years, primarily at Automattic, Mailchimp, and UPS. Since receiving a Master of Science in Marketing Degree from Johns Hopkins University, he’s focused on delivering products that delight people and solve real problems.

Explore the benefits of Jetpack

Learn how Jetpack can help you protect, speed up, and grow your WordPress site.


Get up to 51% off your first year.

Compare plans

Are you seeing the ‘Error establishing a database connection’ notice on your WordPress website? It is a fatal error that makes your WordPress website inaccessible to the users.

This error occurs when WordPress is unable to make a connection to the database. A number of things can affect your WordPress database connection which makes it a bit difficult for beginners to troubleshoot.

In this article, we will show you how to easily fix the error establishing a database connection in WordPress.

Fixing the database connection error in WordPress

What Causes Error Establishing a Database Connection in WordPress?

The ‘Error establishing a database connection’ issue can be caused by incorrect database information in your WordPress settings, corrupt database, or an irresponsive database server.

Database connection error in WordPress

A database is a software which makes it easy to store, organize, and retrieve data into other software.

As a content management system, WordPress uses a database to store all your content and other website data. It then connects to the database each time someone visits your website.

WordPress needs the following information for connecting to the database:

  • Database name
  • Database username
  • Database password
  • Database server

This information is stored in your WordPress configuration file called wp-config.php.

If any of these items are incorrect, WordPress would fail to connect to your database server, and you’ll see the ‘Error establishing a database connection’ error.

It is one of the most common WordPress errors. Apart from incorrect credentials, this error can also appear if the database server is down, or the database files are corrupt.

Let’s take a look at how to fix error establishing database connection issue in WordPress with step by step troubleshooting.

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, just keep reading.

1. Check Your WordPress Database Credentials

The most common reason for database connection error in WordPress is incorrect database credentials. If you have recently moved your WordPress site to a new host, then this could be the most likely reason.

Your WordPress database credentials are stored in the wp-config.php file. It is the WordPress configuration file that contains important WordPress settings including database information.

If you have not edited wp-config.php file before, then take a look at our guide on how to edit wp-config.php file in WordPress.

You’ll be looking for the following lines in the wp-config.php file.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

You need to make sure that the information for the database name, username, password, and database host is correct.

You can confirm this information from your WordPress hosting account dashboard. Simply log in to your hosting account and click on MySQL databases under the database section.

We’re using Bluehost dashboard in our screenshot, but the process will be similar in other hosting control panels.

Database information

This will take you to the database management page in your hosting dashboad. From here, you can find out your database name and the username.

Database name and username

Below that you will find the database users and links to change the user password.

Changing database user password

Once you have confirmed your database name, username, and password, you can change that information in your wp-config.php file if needed.

After that, try visiting your website again to see if the database connection error has gone.

If you can still see the error, then this means that something else is wrong. Continue reading for more troubleshooting steps.

2. Check Your Database Host Information

If you are confident that your database name, username, and password information is correct, then you may want to make sure that you are using the correct database host information.

Most WordPress hosting companies use localhost as your database host. However, some managed WordPress hosting companies use separate servers to host databases. In that case, your database host information will not be localhost.

You need to contact your WordPress hosting company to confirm your database host information.

3. Repair WordPress Database

If you are getting a different error on the wp-admin, for instance, something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database.

You can do this by adding the following line in your wp-config.php file. Make sure to add it just before ‘That’s all, stop editing! Happy blogging’ line wp-config.php.

define('WP_ALLOW_REPAIR', true);

Once you have done that, you can see the settings by visiting this page: http://www.yoursite.com/wp-admin/maint/repair.php

Repair WordPress database

Note: the user does not need to be logged in to access the database repair page. Once you are done repairing and optimizing your database, make sure to remove this code from your wp-config.php.

4. Check if Your Database Server is Down

If everything seems to be correct, and WordPress still cannot connect to the database, then your database server (MySQL server) may be down.

This could happen due to heavy traffic on a server. Basically, your host server just cannot handle the load (especially when you are on shared hosting).

Your site will get really slow and for some users it may even output the error. So the best thing you should do is get on the phone or live chat with your hosting provider and ask them if your MySQL server is responsive.

If you have other websites running on the same server, then you can check those sites to confirm that your SQL server is down.

If you do not have any other site on the same hosting account, then simply go to your hosting dashboard and try to access phpMyAdmin and connect the database.

If you can connect, then we need to verify if your database user has sufficient permission. Create a new file called testconnection.php and paste the following code in it:

<?php
$link = mysqli_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully';
mysqli_close($link);
?>

Make sure to replace the username and password. You can now upload this file to your website and access it via web browser.

If the script connected successfully, then it means that your user has sufficient permission, and there is something else that is wrong.

Go back to your wp-config file to make sure that everything there is correct (re-scan for typos).

Other Solutions That Have Worked for Users

If the above-mentioned troubleshooting tips failed to fix the database connection error on your website, then you may try these additional steps.

Reported by our users, these steps have helped some users resolve the database connection error on their websites.

1. Update WordPress Site URL

Try updating the WordPress site URL using phpMyAdmin. Simply access phpMyAdmin from your hosting account dashboard, and select your WordPress database.

Running SQL in phpMyAdmin

After that click on the SQL menu on the top and enter the following MySQL query.

UPDATE wp_options SET option_value='YOUR_SITE_URL' WHERE option_name='siteurl'

Don’t forget to provide your own site URL and change wp_options to your own table name as you may have changed the WordPress table prefix.

2. Rebooting Web Server

Users on dedicated servers, local server, and virtual private servers (VPS) can try rebooting their servers.

This will restart your web and database server which may fix some temporary glitches causing the error.

3. Ask for help

If everything else fails, then you may need to contact your web hosting company. All good WordPress hosting companies will help you troubleshoot the problem, point you in the right direction, or even fix it for you.

You can also hire WordPress developers from Codeable that can help you fix this issue for reasonable rates. The best part is that these developers are highly-vetted by Codeable team, so you know they can be trusted.

We hope this article helped you fix the error establishing a database connection in WordPress. You may also want to see our WordPress troubleshooting guide for tips on resolving WordPress issues on your own.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience building WordPress websites. We have been creating WordPress tutorials since 2009, and WPBeginner has become the largest free WordPress resource site in the industry.

Few things are as frustrating as finding that your website is down — particularly if you rely on it for business. The Error Establishing a Database Connection message represents a serious issue and prevents all access to your site, so fixing it is a top priority. However, if you’re not familiar with how WordPress works, it can be a confusing problem.

Don’t fret. Although this error is serious, it’s also highly fixable. With a few troubleshooting steps, you can have your site back online in no time. Here’s what we’ll cover:

  • What is the Error Establishing a Database Connection?
  • Common Causes of Database Connection Errors
  • How to Fix the Error Establishing a Database Connection (4 Steps)

Let’s get started!

Get Content Delivered Straight to Your Inbox

Subscribe to our blog and receive great content just like this delivered straight to your inbox.

Understanding the Error Establishing a Database Connection in WordPress

Before we dig too much into this particular error message, let’s have a brief lesson on how WordPress sites work. Nearly all website information — including post data, plugin settings, login credentials, and more — is stored and organized in a MySQL database.

DreamHost Glossary

MySQL

MySQL is a relational database management system that offers practical management tools. You can use MySQL to create, modify, and extract data from relational databases through the SQL programming language. It can also control the access that users have to the database.

Read More

When a visitor comes to your site, WordPress uses PHP to query the database and pull the correct information, which is then displayed as the complete page.

If, for whatever reason, WordPress can’t access your site’s database or it isn’t working properly, the result is an Error Establishing a Database Connection message.

The Error Establishing a Database Connection message on a WordPress site.

This error prevents the entire page from loading. In fact, you won’t even be able to access the WordPress dashboard (your site’s back end).

If your site uses caching, visitors may still see stored copies of your pages. Therefore, if you catch the error early and resolve the problem before your site’s cache refreshes, you can avoid too many interruptions to your site and business.

Fortunately, as WordPress errors go, a database connection error is usually pretty simple to resolve. The most common cause, by far, is just a mismatch of login credentials for the database.

Common Causes of the Error Establishing a Database Connection

There are four typical causes of the database connection error:

  • Incorrect database login credentials. Possibly the most common cause of the Error Establishing a Database Connection is simply that WordPress has incorrect login credentials for your database. This could be either the database name, username, or password. Remember, these login details are different from the ones you use to access your site.
  • Database corruption. A WordPress MySQL database contains a lot of information. If any part is deleted or corrupted, the result can be the error in question. Corruption can result from manually tinkering with the database, but it can also just happen as a consequence of normal use. Although MySQL is quite robust, nothing is perfect, and errors do occur.
  • WordPress core file corruption. Similarly, corruption can occur in the core WordPress files that make up your site. Even though these files are outside the database, they may sometimes result in the same error.
  • Problems with the web server or hosting provider. If problems arise with your host or server (if you’re self-hosting) and WordPress can’t reach it to query the database, it will throw this error. These problems can include outages, data loss, and hardware failures.

As we said, incorrect credentials are the most common cause of the error, but any of these could be the culprit. For that reason, fixing the error can involve some troubleshooting.

How to Fix the Error Establishing a Database Connection in WordPress (In 4 Steps)

Although this is a serious error, it’s fortunately fairly easy to resolve. Below, you’ll find step-by-step instructions for troubleshooting and fixing the problem. Note that you should try each step in order, only moving to the next if one doesn’t work.

Step 1: Check Your WordPress Database Credentials

Since this is the most likely cause of the error, it should also be the first step in your troubleshooting. The first thing you’ll need to do is locate the credentials WordPress is currently using to access your database.

This information is stored in your site’s wp-config.php file. You can use a Secure File Transfer Protocol (SFTP) client to access it.

Alternatively, if your site is hosted with DreamHost, you can access the file system from the DreamHost Control Panel. To do so, sign in to your control panel and navigate to Domains > Websites. Hover the mouse over the domain you’d like to fix, then click ‘manage’ to see the folder icon. Then click on the file folder symbol next to the site that’s experiencing the error.

Inside the file browser, select the folder named after your website, then open wp-config.php. Here, look for three pieces of information — the database name, username, and password. They should be near the top of the file.

The database login credentials in the wp-config.php file.

With this information in hand, head to your DreamHost Panel and navigate to More > MySQL Databases. Look for the hostname that corresponds to your website’s name. It will be formatted as mysql.yoursitename.com, with “yoursitename” being the name of your website.

If the hostname isn’t on this page, skip down to Step 2 and come back here when you’re done adding it.

In the section called Database(s) on this server, make sure the database name matches the one you pulled from wp-config.php earlier. If it does, this isn’t the problem, and you can move on to the next step.

If it doesn’t match, go back to wp-config.php and update it with the correct database name.

Next, you can find the usernames that have access to each database beside their names on the MySQL Databases page.

The usernames that have access to the database listed in the DreamHost Control Panel.

To view the password, click on the username. On the page that opens, scroll down to the Current Password field and click on Show.

The password options for a database user in the DreamHost Control Panel.

If the username or password doesn’t match your wp-config.php file, update it with the correct details. Alternatively, if the username matches but the password doesn’t, you could update the database password on the User Details screen.

Step 2: Check Your Database Host Information

If you’ve checked the database login credentials and fixed any errors, but you’re still getting the Error Establishing a Database Connection message, the next thing you should check is your database host information.

The hostname for your database can be found in wp-config.php, right alongside the database name and login credentials.

The MySQL database hostname in the wp-config.php file.

Note this information, then head back to your DreamHost Panel and navigate to More > MySQL Databases. This time, you’re looking to make sure the hostname in your wp-config.php file is listed on this page. If it’s not, you’ll need to add it.

To add a hostname, simply click on the Add New Hostname button. On the next page, enter the hostname you want to use and select the correct website domain from the dropdown.

When you’re finished, click on Create this MySQL hostname now! Note that it can take a few hours for this new hostname to propagate through the DNS, so feel free to take a break here. When some time has passed, come back and check if your site is working. If you’re still getting the database error message, proceed to the next step.

Step 3: Repair Your WordPress Database

If you’re still receiving the error message, you can try repairing the database to fix possible corruption. We recommend using the built-in WordPress database repair tool for this.

To access it, open up your wp-config.php file and add the following code at the end:

define('WP_ALLOW_REPAIR', true);

Next, open a new browser tab and navigate to https://yoursitename.com/wp-admin/maint/repair.php, replacing “yoursitename” with your website’s actual domain. This will bring up the database repair tool.

The WordPress database repair tool.

Click on Repair Database and let it do its thing. You can choose Repair and Optimize Database if you like, but it takes considerably longer. Either way, when the tool is finished, load your website again and check for the error. If it’s gone, then you’ll know a corrupted database was the cause.

However, if you’re still seeing the error message, head to the next step. Before you do, make sure to head back into wp-config.php and delete the code you added to turn on the tool. If you leave it there, someone with ill intentions could gain access to your site easily.

Step 4: Check if Your Database Server Is Down

If all the above steps have failed, one final possibility is that your database server has gone down. At this point, it’s a good idea to verify with your hosting provider that everything is working correctly.

There are a number of reasons why your database host or server might be experiencing issues:

  • Too many simultaneous connections to the database. Some providers have limits on how many connections a server can have at one time.
  • Problems with another site on your shared hosting server. If you’re on a shared hosting plan, you’re splitting resources with other sites. If one of them has problems, it can spill over to your site. This is one of the reasons dedicated or managed WordPress hosting plans can be beneficial.
  • Hardware troubles. Hardware eventually fails, and it’s possible that the server your database is stored on has done just that. Ideally, your host will have redundancies in place so that if one server goes down, there’s another copy of your data available, but this isn’t always the case — especially if you’re hosting your own database on a home or office server.

Your best bet here is to reach out to your web host and inquire about outages or other known issues. If there are none, you can report your problem and ask the support staff to look into it for you.

At DreamHost, you can always find your support options by clicking on the Support button in the top right corner of your control panel:

Support options in the DreamHost Control Panel.

DreamHost offers 24/7 support, so you can get help any time you need it.

Additional Tips and Solutions That Have Worked for Other Users

If you’ve tried all of the above tips and you’re still having trouble with the Error Establishing a Database Connection, there are a couple of other options that have worked for some users. You can try these either before or after going through the troubleshooting steps above:

  • Update your WordPress site URL. If you’ve recently moved your WordPress installation for any reason (such as moving to a new domain name or migrating to HTTPS), you may need to update your site URL in the database. You can find full instructions for doing so in our knowledge base.
  • Reboot your web server. This one might seem a little basic, but sometimes the simplest solutions are the most effective. If you host your database on your own server, try turning it off and back on. Computers are complex, and a simple reboot can fix all manner of odd problems you may be experiencing.
  • Ask for help. If you’re not comfortable doing your own troubleshooting, or you’ve tried everything and still can’t get rid of the Error Establishing a Database Connection message, there’s no shame in reaching out for help. You can get in touch with DreamHost support 24/7 by clicking the Support button in your DreamHost panel. You can also try searching on help forums such as Stack Exchange or Quora. Your question may have already been answered on one of these sites. If not, you can always ask.

At this point, you’ve hopefully resolved the issue and gotten your site back up and running.

Further Reading

Want to learn more about fixing common WordPress errors? We’ve got you covered!

  • How to Fix the 500 Internal Server Error in WordPress
  • How to Fix Syntax Errors in WordPress
  • How to Fix the WordPress Not Sending Email Issue

Ready to Fix a Database Connection Issue?

If you’ve gone to check on your website and found yourself greeted by the Error Establishing a Database Connection message, you’re not alone. It’s a common error with relatively simple fixes, so getting your site up and running again shouldn’t be too difficult.

You should follow these steps to troubleshoot a database connection error:

  1. Check your WordPress database credentials.
  2. Check your database host information.
  3. Repair your WordPress database.
  4. Check if your database server is down.

If you’d rather not have to deal with these types of problems in the future, consider upgrading to DreamPress, our managed WordPress hosting service. Then you can leave the troubleshooting to us!

Понравилась статья? Поделить с друзьями:

Не пропустите эти материалы по теме:

  • Яндекс еда ошибка привязки карты
  • Ошибка error during initialization unhandled exception caught
  • Ошибка error displaying the error page
  • Ошибка error development 002
  • Ошибка error description

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии