Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Wie man den Fehler beim Herstellen einer Datenbankverbindung in WordPress behebt

Sehen Sie die Meldung „Fehler beim Herstellen einer Datenbankverbindung“ in WordPress?

Dies ist ein schwerwiegender Fehler, der Ihre Website für die Benutzer unzugänglich macht. Er tritt auf, wenn WordPress nicht in der Lage ist, eine Verbindung mit der Datenbank herzustellen. Da mehrere Faktoren diese Verbindung beeinträchtigen können, kann die Fehlerbehebung für Anfänger etwas schwierig sein.

In diesem Artikel zeigen wir Ihnen, wie Sie das Problem „Fehler beim Herstellen einer Datenbankverbindung“ auf Ihrer WordPress-Website Schritt für Schritt beheben können.

Fix the Error Establishing a Database Connection in WordPress

Was ist die Ursache für den Fehler beim Herstellen einer Datenbankverbindung in WordPress?

Eine Datenbank ist eine Software, die das Speichern, Organisieren und Abrufen von Daten aus anderer Software erleichtert.

Als Content-Management-System verwendet WordPress eine Datenbank, in der alle Inhalte und andere Daten Ihrer Website gespeichert werden. Jedes Mal, wenn jemand Ihre Website besucht, stellt es eine Verbindung zur Datenbank her.

WordPress benötigt die folgenden Informationen für die Verbindung zur Datenbank:

  • Ihr Datenbankname
  • Datenbank-Benutzername und Passwort
  • Datenbank-Server

Diese Informationen werden in Ihrer WordPress-Konfigurationsdatei gespeichert, die wp-config.php heißt.

Wenn eine dieser Informationen nicht korrekt ist, kann WordPress keine Verbindung zu Ihrem Datenbankserver herstellen, und Sie erhalten die Fehlermeldung „Fehler beim Herstellen einer Datenbankverbindung“.

Database connection error in WordPress

Dies ist einer der häufigsten WordPress-Fehler. Abgesehen von falschen Anmeldeinformationen kann dieser Fehler auch auftreten, wenn der Datenbankserver ausgefallen ist oder die Datenbankdateien beschädigt sind.

Schauen wir uns nun an, wie man das Problem „Fehler beim Herstellen einer Datenbankverbindung“ in WordPress mit einer schrittweisen Fehlerbehebung beheben kann.

1. Überprüfen Sie Ihre WordPress-Datenbank-Zugangsdaten

Der häufigste Grund für den Datenbankverbindungsfehler sind falsche Anmeldedaten. Wenn Sie Ihre WordPress-Website vor kurzem auf einen neuen Host verschoben haben, ist dies wahrscheinlich das Problem.

Die Zugangsdaten für Ihre WordPress-Datenbank sind in der Datei wp-config.php gespeichert. Es handelt sich um die WordPress-Konfigurationsdatei, die wichtige Einstellungen, einschließlich Datenbankinformationen, enthält.

Wenn Sie die Datei wp-config.php noch nie bearbeitet haben, lesen Sie bitte unsere Anleitung für Anfänger zum Bearbeiten der Datei wp-config.php.

Sie suchen in der Datei wp-config.php nach den folgenden Zeilen:

// ** 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' );

Hier müssen Sie sicherstellen, dass die Informationen für den Datenbanknamen, den Benutzernamen, das Passwort und den Datenbankhost korrekt sind.

Sie können diese Informationen über das Dashboard Ihres WordPress-Hosting-Kontos bestätigen. In diesem Tutorial verwenden wir Bluehost, aber der Vorgang ist auch bei anderen Hosting-Panels ähnlich.

Klicken Sie nach dem Einloggen auf die Registerkarte „Website“ in der linken Spalte und wechseln Sie dann auf die Registerkarte „Erweitert“. Scrollen Sie dann nach unten zum Abschnitt „Datenbank“ und klicken Sie auf die Schaltfläche „Verwalten“ daneben.

Click the Manage button next to the Database section

Dadurch wird die Seite MySQL-Datenbanken in cPanel in einem neuen Fenster geöffnet.

Hier finden Sie Ihren Datenbanknamen und Ihren Benutzernamen im Abschnitt „Aktuelle Datenbank“. Denken Sie daran, diese Angaben zu kopieren und in einen Notizblock einzufügen, damit Sie sie der wp-config-Datei hinzufügen können.

Find your database name and username in the Current Databases section

Blättern Sie dann zum Abschnitt „Aktuelle Benutzer“, wo Sie auf den Link „Passwort ändern“ neben Ihrem Datenbanknamen klicken können.

Daraufhin wird ein neuer Bildschirm angezeigt, in dem Sie das Datenbankpasswort nach Ihren Wünschen ändern können.

Change your database password

Sobald Sie alle Angaben zu Ihrer Datenbank bestätigt haben, können Sie diese Informationen bei Bedarf in Ihrer wp-config.php-Datei ändern.

Versuchen Sie danach, Ihre Website erneut zu besuchen, um zu sehen, ob der Datenbankverbindungsfehler verschwunden ist.

Wenn Sie den Fehler immer noch sehen, bedeutet dies, dass etwas anderes nicht stimmt.

2. Prüfen Sie Ihre Datenbank-Host-Informationen

Wenn Sie sicher sind, dass Ihr Datenbankname, Ihr Benutzername und Ihr Kennwort korrekt sind, sollten Sie sich vergewissern, dass Sie die richtigen Datenbank-Hostinformationen verwenden.

Die meisten WordPress-Hosting-Unternehmen verwenden localhost als Datenbank-Host. Einige Managed-WordPress-Hosting-Unternehmen verwenden jedoch separate Server zum Hosten von Datenbanken. In diesem Fall ist Ihr Datenbank-Host nicht localhost.

Das bedeutet, dass Sie sich mit Ihrem WordPress-Hosting-Unternehmen in Verbindung setzen müssen, um diese Angaben zu bestätigen.

3. WordPress-Datenbank reparieren

Möglicherweise erhalten Sie jetzt eine andere Fehlermeldung im wp-admin Dashboard wie „Eine oder mehrere Datenbanktabellen sind nicht verfügbar“ oder „Die Datenbank muss möglicherweise repariert werden“. In diesem Fall müssen Sie Ihre Datenbank reparieren.

Fügen Sie dazu die folgende Zeile in Ihre wp-config.php-Datei ein. Fügen Sie sie direkt vor der Zeile ‚That’s all, stop editing! Viel Spaß beim Bloggen“:

define('WP_ALLOW_REPAIR', true);

Sobald Sie dies getan haben, können Sie die Einstellungen auf dieser Seite sehen: http://www.yoursite.com/wp-admin/maint/repair.php. Achten Sie nur darauf, dass Sie yoursite.com durch Ihren eigenen Domänennamen ersetzen.

Hier müssen Sie auf die Schaltfläche „Datenbank reparieren“ klicken, um den Vorgang zu starten.

Repair WordPress database

Hinweis: Der Benutzer muss nicht angemeldet sein, um auf die Seite zur Reparatur der Datenbank zugreifen zu können. Sobald Sie mit der Reparatur und Optimierung Ihrer Datenbank fertig sind, stellen Sie sicher, dass Sie diese Codezeile aus Ihrer wp-config.php entfernen.

Wenn Sie jedoch keinen Code zu Ihrer Website hinzufügen möchten, können Sie Ihre Datenbank auch über das cPanel Ihres Hosting-Kontos reparieren.

Gehen Sie zu Ihrem Hosting-Account und öffnen Sie dort in der linken Spalte die Seite „Websites“. Wechseln Sie dann auf die Registerkarte „Erweitert“ und klicken Sie im Bereich „Datenbank“ auf die Schaltfläche „Verwalten“.

Click the Manage button next to the Database section

Dadurch wird cPanel in einer neuen Registerkarte geöffnet. Scrollen Sie hier zum Abschnitt „Datenbanken ändern“ und wählen Sie den Namen Ihrer Datenbank aus dem Dropdown-Menü „Datenbank reparieren“.

Klicken Sie dann einfach auf die Schaltfläche „Datenbank reparieren“, um den Vorgang zu starten.

Click the Repair database button

Das Hosting-Panel wird nun automatisch Ihre Datenbank für Sie reparieren.

Sobald der Vorgang abgeschlossen ist, wird auch eine Erfolgsmeldung angezeigt.

Database repair success message

Sie können nun Ihre WordPress-Website besuchen, um zu sehen, ob der Fehler behoben wurde oder nicht.

4. Prüfen Sie, ob Ihr Datenbankserver ausgefallen ist

Wenn alles korrekt zu sein scheint und WordPress immer noch keine Verbindung zur Datenbank herstellen kann, ist Ihr Datenbankserver(MySQL-Server) möglicherweise ausgefallen.

Dies kann aufgrund von starkem Datenverkehr auf einem Server passieren. Ihr Host-Server kann die Last einfach nicht bewältigen (vor allem, wenn Sie ein Shared Hosting nutzen).

Dies führt dazu, dass Ihre Website langsam wird und bei einigen Benutzern sogar einen Fehler ausgibt. In diesem Fall sollten Sie mit Ihrem Hosting-Provider telefonieren oder live chatten und ihn fragen, ob Ihr MySQL-Server ansprechbar ist.

Wenn Sie außerdem andere Websites auf demselben Server betreiben, können Sie diese Websites überprüfen, um festzustellen, ob Ihr SQL-Server ausgefallen ist.

Wenn Sie keine andere Website auf demselben Hosting-Account haben, gehen Sie einfach auf Ihr Hosting-Dashboard und wechseln Sie auf die Registerkarte „Erweitert“.

Klicken Sie anschließend auf die Schaltfläche „Verwalten“ neben dem phpMyAdmin-Bereich.

Click the Manage button next to the PHPMyAdmin option

Dadurch wird phpMyAdmin in einem neuen Fenster geöffnet, in dem Sie oben auf die Option „Datenbank“ klicken müssen.

Klicken Sie dann auf den Namen Ihrer Datenbank, um deren Einstellungen aufzurufen. Wenn Sie dies tun können, ist es an der Zeit zu prüfen, ob Ihr Datenbankbenutzer über ausreichende Berechtigungen verfügt.

Connect PHPMyAdmin with your database

Dazu müssen Sie eine neue Datei mit dem Namen testconnection.php erstellen und den folgenden Code darin einfügen:

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

Achten Sie beim Einfügen des Codes darauf, dass Sie den Benutzernamen und das Passwort durch Ihren eigenen ersetzen. Sie können diese Datei nun auf Ihre Website hochladen und über einen Webbrowser darauf zugreifen.

Wenn das Skript erfolgreich verbunden wurde, bedeutet dies, dass Ihr Benutzer über ausreichende Berechtigungen verfügt und der Fehler durch etwas anderes verursacht wird.

Nun müssen Sie zu Ihrer wp-config-Datei zurückkehren und sie überprüfen, um sicherzustellen, dass alle Angaben korrekt und ohne Tippfehler sind.

Zusätzliche Lösungen, die sich für Benutzer bewährt haben

Wenn die oben genannten Tipps zur Fehlerbehebung nicht ausreichen, um den Datenbankverbindungsfehler auf Ihrer Website zu beheben, können Sie diese zusätzlichen Schritte versuchen.

Wie von unseren Benutzern berichtet, haben diese Schritte einigen von ihnen geholfen, den Datenbankverbindungsfehler auf ihren Websites zu beheben.

1. Aktualisieren Sie die URL der WordPress-Website

Sie können versuchen, die URL der WordPress-Website mit phpMyAdmin im cPanel zu aktualisieren.

Rufen Sie einfach phpMyAdmin über das Dashboard Ihres Hosting-Accounts auf und wählen Sie Ihre WordPress-Datenbank aus der Liste aus.

Wechseln Sie dann oben in das SQL-Menü und geben Sie die folgende MySQL-Abfrage ein:

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

Sie sollte folgendermaßen aussehen:

Change site URL

Vergessen Sie nicht, die URL Ihrer eigenen Website anzugeben und wp_options in Ihren eigenen Tabellennamen zu ändern, da Sie möglicherweise das WordPress-Tabellenpräfix geändert haben.

2. Neustart des Webservers

Benutzer von dedizierten Servern, lokalen Servern und virtuellen privaten Servern (VPS ) können versuchen, ihre Server neu zu starten.

Dadurch wird Ihr Web- und Datenbankserver neu gestartet, was möglicherweise einige vorübergehende Störungen behebt, die den Fehler verursachen.

3. Um Hilfe bitten

Wenn alles andere fehlschlägt, sollten Sie sich an Ihr Webhosting-Unternehmen wenden. Alle guten WordPress-Hosting-Unternehmen werden Ihnen bei der Fehlersuche helfen, Ihnen die richtige Richtung weisen oder das Problem sogar für Sie beheben.

Sie können auch WordPress Entwickler über eine Plattform wie WPBeginner Pro Services anheuern, um dieses Problem zu vernünftigen Preisen zu lösen. Wir haben ein engagiertes Team von erfahrenen Entwicklern, denen Sie vertrauen können, um alle Ihre WordPress-Probleme zu lösen.

WPBeginner Pro Services

Außerdem können Sie den Dienst für die Wartung Ihrer Website, die Reparatur von gehackten Websites, die Geschwindigkeitsoptimierung, den Wiederaufbau von Websites und die SEO-Optimierung nutzen.

Wir hoffen, dass dieser Artikel Ihnen geholfen hat, das Problem „Fehler beim Herstellen einer Datenbankverbindung“ in WordPress zu beheben. Vielleicht möchten Sie auch unseren WordPress-Leitfaden zur Fehlerbehebung lesen, um Tipps zur Behebung von WordPress-Problemen zu erhalten, oder unsere Expertenauswahl der besten Tools für WordPress-Freiberufler und Entwickler.

Wenn Ihnen dieser Artikel gefallen hat, dann abonnieren Sie bitte unseren YouTube-Kanal für WordPress-Videotutorials. Sie können uns auch auf Twitter und Facebook finden.

Offenlegung: Unsere Inhalte werden von unseren Lesern unterstützt. Das bedeutet, dass wir möglicherweise eine Provision verdienen, wenn Sie auf einige unserer Links klicken. Mehr dazu erfahren Sie unter Wie WPBeginner finanziert wird , warum das wichtig ist und wie Sie uns unterstützen können. Hier finden Sie unseren redaktionellen Prozess .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Das ultimative WordPress Toolkit

Erhalte KOSTENLOSEN Zugang zu unserem Toolkit - eine Sammlung von WordPress-bezogenen Produkten und Ressourcen, die jeder Profi haben sollte!

Reader Interactions

661 KommentareEine Antwort hinterlassen

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Faran

    Thank God I found this article. Replacing wordpress database password and username with my cpanel login credentials got me through it.

  3. Adrian Ramos

    Thank you!

    i solved the problem by changing my new username and password in the wp-config file.

    Regards

  4. Giorgos

    Another solution that worked. Delete the current MySql user and add a new one. It’s a solution for this specific error:
    Access denied for user ‘foo’@’%’ (using password: YES)

  5. Derek Morrison

    Hi, Im a long way in to my blog with txt and pictures however, I am new to this and now finding my uploading of media is freezing 4/5 in and goes to error. Looking on the web found many others have had this problem, however, the common stream is increase image memory I’ve only used 115 MB what’s going on does anyone know? I’m very frustrated as I can try and try for HOURS sometimes to upload
    Thank you

  6. Paul Hutchinson

    Had this error pop up yesterday on my ten year old WordPress installation that is hosted @ GoDaddy.

    Turns out GoDaddy changed the Hostname for the SQL server. updated the DB_Host value and all is working fine.

    Thanks for the detailed post about this issue.

  7. Bhavesh

    I do have same issue with GoDaddy, tried everything out from this post and others.

    but not get any result.

    After heading everything I just tried to change the user name as it was same as database name before.

    and the issue solved.

    so thought the issue is having database and username is same for the DB.

  8. Kaustav Banerjee

    Super effective article. It has just happened with me. The most common mistake of all is the difference between password set for database user from backend and the one mentioned in wp-config .How could I forget this…
    Thanks a lot!!

  9. alex.s

    One thing that needs to be mentioned that if you are using MAMP the password for the database is root as a default. This little thing took me hrs to figure out.

  10. Dlee

    Thanks for this guide, it really saved me! I changed my database password not realizing what would happen, I managed to fix it thanks to this guide though :)

  11. Dev

    If it helps, I would like to add that my particular problem occurred when I updated the password to my database through godaddy, and the wp-config file did NOT update the password, I had to go in manually to change it.

    /** MySQL database password */
    define(‚DB_PASSWORD‘, ‚PasswordGoesHere);

    • Jesse Josserand

      I pretty much had to do everything above including changing the password in wp-config. After all that… and editing my sql backup I was restoring so that it used the correct db_name and username and password, as well, everything started work except for errors caused by problems with the super cache plugin. I’m still fighting that issue, but hallelujah to God and all y’all above for getting me this far!

  12. David Kley

    This is why we use Joomla more than WordPress. ;)

    Easier to move, easier to set up quickly, easier to troubleshoot. WordPress makes it a huge pain if you want to move your site to another server or change domains. To each their own though. Each has it’s own set of weaknesses.

  13. Bev

    I have the problem intermittently and randomly. It doesn’t stop the site from working entirely, the ‚error establishing a database connection‘ message shows up randomly (both backend and frontend). My host says the problem is a plugin conflict. I’d be happy to test that but because the problem is random, I can’t tell immediately if deactivating a plugin will help. Arrggh!

    • Steph

      We started having this issue recently as well. We contacted our host and they said it sounds like our database is either maxing its connections or our tables are locked during a call (which would most likely happen from a plugin).

  14. Tomas Hujer

    Hi, in my case it was been problem in bad domain values in table wp_blogs. There must be valid domains.

    Good Luck!

  15. Sreekant Shenoy

    Thanks you bro.. very very much..it workd.. :D I am very happy..luv you so much..I am on GoDaddy and i just placed the testfile.php and it workd..Thank you very much <3 <3 <3 <3

  16. Joel Donfak

    I had the same issue with a new website and I finally found that the MySQL username in the CPANEL was not linked to the database. After doing it, it work properly!

    So make sure the problem doesn’t come from there.

  17. Ed

    I changed my MySQL password for security reasons and updated it right away in wp-config but now I get the „Error Establishing a Database Connection“ on both front and back end. I know my login credentials work as I can connect fine to phpMyAdmin.

    – I tried a fresh re-install of WordPress via FTP (without overwriting wp-config or wp-content folder) and that didn’t help.

    – I am trying to do the database repair method mentioned above but I can’t even access that page as it won’t let me get past the database connection error.

    – I tried the test connection method and get the following error:

    Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /srv/users/serverpilot/apps/xxxxxx/public/testconnection.php on line 2

    Warning: mysql_connect(): Access denied for user ‚root’@’localhost‘ (using password: YES) in /srv/users/serverpilot/apps/xxxxxxxx/public/testconnection.php on line 2
    Error: Access denied for user ‚root’@’localhost‘ (using password: YES)

    None of these solutions work! Please help someone! I haven’t touched my wordpress site or made any changes prior to the mySQL password update so I know it’s not a wordpress code or plugin issue. Would nginx or cache effect this?

    • dev

      Go to wp-config file and find this:

      /** MySQL database password */
      define(‚DB_PASSWORD‘, ‚PasswordGoesHere‘);

      Make sure the password matches what you use to log in to your database.

  18. Kyle Coombs

    So, I have always accessed WordPress via the internet and never downloaded the client onto my computer. I’ve always wondered why someone would want to do that and now I think I understand why after receiving this same error message.

    I’m curious, can I do any if I cannot access my WordPress account to make these changes listed? Or do I need to contact my host or hope that problem resolves itself?

    Just checking if there’s anything I can do on the front end.

  19. Dave_Whittle

    I had this error yesterday, and to make a long story short, the solution was as simple as restarting MySQL, i.e. issuing the following commands from the command line:

    sudo mysql stop
    sudo mysql start

  20. Shoaib

    Thanks this one helped me :)
    define(‚DB_HOST‘, ‚127.0.0.1:8889‘);

  21. mohadsl

    Hi, I have been reading this message over and over when I log in to another domain for my WordPress. Please help

    Error: Unable to find the specified administrator account in WordPress. Specify the username of your administrator’s account in WordPress. This account will be associated with Plesk.

  22. Kurtis

    I was trying to load my website (from backups) to a new hosting company today. It was tricky figuring out how to make it work. Ended up installing and uninstalling a bunch of times due to some mistakes. I first tried loading my wordpress files via FTP and creating a new Mysql database manually in my hosting control panel, but I could not get the two to see eachother and could not import my backed up SQL file to the new database, finally figured out (after some trial and error), i needed to install a fresh wordpress from my hosting control panel which installs wordpress for me and creates a database. Once there is a linked database you can drop all the tables, and import the backed up database. I would then upload my wordpress backup via FTP on top of the fresh install and choose ‚Overwrite‘. When it finished, I had the front page of my website showing up like it was working, but all the pages were „object not found, no database, or page outdated, please notify the author, etc.“…. I tried repairing/optimizing the database, which did not help…. I updated my wp-config file with the right database info, which did not fix it….So I uninstalled everything and started over many times (uninstalling reinstalling with the same results — FINALLY WHAT WORKED. fresh wordpress install via my control panel, I used the same username password for the admin that I previously had used on my old site (this helped my new wordpress „see the mysql backup“ better once I imported it), then FTP the wordpress backup files on top of the fresh install with overwrite option. change the wp-config code to the new database info (mine was a new database name/pw everytime i reinstalled wordpress). After I did all of this I was getting the front page but still getting „object not found“ pages for everything else. BUT now I could login to my admin…. once I was at this point, I realized that wordpress or the server wass checking itself (updating itself) after all of the major changes I had made via FTP and MySQL…. basically just wait, I think I waited a half hour to an hour and I started seeing my other pages (without graphics), took a nap, and then all the pages were there. I only had a few pages and posts but after such major changes, the server had to catch up and verify itself, I think…

  23. Jhood

    Just wanted to share my experience – I received this error when I created my account in cPanel with a user name that was more than 8 characters long. Apparently it confused the WordPress installer, and it couldn’t create the database.

    So I just deleted the entire Cpanel account and started over with a cPanel user name of 8 characters – worked like a charm!

  24. Sarah Baker

    I tried just about all these things and nothing worked – just about but not all. I’m not an expert but not a beginner. Finally, I decided to delete the account from the server (new site with no data yet), start over, and install WordPress manually. I use Rochen which uses cPanel and Fantastico and it’s only been recently that I’ve been having this problem.

    Installing manually worked fine and I had no problems. Will be submitting a support ticket to Rochen for sure.

  25. Penina

    I built my site on an Amazon ec2 instance and frequently get the Error establishing database connection on both the frontend and backend. what I do that always solves the problem is telnet into the server and restart mysqld. But I was wondering what the underlying issue was that is always causing this error to recur. any ideas??

    • shaun2k

      You’re running out of RAM and memory management is killing your mysqld process. You will need to upgrade to an instance that has at least 2GB RAM. I’m tipping you’re on free tier and you have 1GB of RAM.

  26. KyleM

    For me what worked was changing localhost entry in wpconfig.php to 127.0.0.1; they may work with out doing all of the above so its a quick. I must say all this data above was a good start for me to understand the problem and root cause.

  27. Christina Torres

    Totally random, and maybe this is dumb, but I realized my problem on Mac was that it kept changing a regular ‚ into a stylized one in text edit every time I added in my username, password, database name, etc, even as a text file. weird. anyway, thanks for the help!

  28. Colin Murphy

    Just incase other people have had the same issue you get this error also on a multisite installation if the URL’s in the wp_blogs are not set correctly . I had this issue this morning when moving the site from my dev version to staging.

  29. Jack Bobeck

    I just experienced it on our site, first time. So I did as you recommended, called Bluehost, our host provider to find out WTH? They said that our database is limited to 15 connections at once, and that because of activity, when you hit that ceiling, you get that error. So they suggested we run a test on all of our plugins and see if there are some that are hogging connections, then run a program that converts our pages to HTML pages as a backup, in case people want to access the site as a backup and do so in a quicker manner. I hope this makes sense, not an expert web guy, but just repeating best I can. But best thing to do first is contact your host provider for answers.

    Jack

  30. Ryan Turner

    I just had the same problem for my site. Went through the article and didn’t see anything out of the ordinary. messing around in wordpress I reset my ‚WP Super Cache‘ plugin to the defaults and cleared it out and my site started working again.

  31. Ali Khan

    Doesn’t let me sign into phpmyadmin from my cPanel, saying account is not verified.

  32. Daniel DeNewasha

    Intermittently I get the following error visiting the site. There’s absolutely nothing on major search engines with this error number alone. I can get to wp-admin, which is the sites login page with theme loaded, etc. and login. In Admin, I can do anything with no issues. Sometimes I can visit the site, other times not, even in different browsers, e.g., on refresh may or may not appear. Have done the repair and settings show no errors. I am on Godaddy shared hosting. Just finished building site so very little content, DB incredibly small 2mb on export.

    „ERROR 677-402iqz. We’re sorry, error reading database, missing or
    corrupt. This website is no longer unavailable.“

    Any ideas anyone?
    Thanks
    Daniel

  33. WPBeginner Staff

    WordPress stores all your site’s information in a database, which is managed by a database server. If for some reason WordPress is unable to connect to the database server then you will get this error. Please contact your web hosting provider for support.

  34. terry

    I was trying to fix non appearance of widgets on my site when I got
    „Could not connect to the DB Server!“
    . Even when I just enter the site in the address box or include wp-admin.
    I have no idea now. Just assume I am a 5 year old idiot if you reply.

  35. Syed Balkhi

    If you’re getting on a welcome screen, then it means that you replaced your database credentials.

  36. john

    Hi my site has been off since this morning telling me Error establishing a database connection in french since it is a french website http://c2cteaching.com
    I called my host who told me to modify my wp-config.php, and since we did I land on a welcome setting page of wordpress ! I’m getting crazy, what can i do ? help me please !

  37. Vijay

    Hi, I had this error show up on our primary domain, add-on domains and a sub-domain.

    I use GoDaddy for hosting.

    Long story short: We found that because for some reason the MySQL databases table inside hosting > databases didn’t have any users attached to the databases that the sites were showing this particular error.

    Just below that table on the right hand side, there is a ‚Add User to Database‘ section. I assigned each user to a database. So, i388299_wp1 was selected as user and i388299_wp1 was selected as the database and all the sites started working fine again.

    So, there is a bug in GoDaddy that causes users to be deleted from that list for some strange reason.

  38. karelles

    I was trying to clean up and tossed some mysql servers (they’re all one anyway) that I thought I wasn’t using and one of my site alarms went off. Sure enough that site was using the server that I tossed. Changed to a different server (as I said they’re all one) in the wp-config file and all was again well. Thanks!!!

  39. Vonnie Hudson

    I had this problem today on my VPS. Error establishing connection to Database. Checked disk space and confirmed it was fine but memory usage was almost depleted. I ran sudo free -m and top to find the biggest offenders but couldn’t really figure it out. I had something like 5MB of RAM left. I even rebooted the server but that didn’t fix it. So I just waited and eventually it came back – my only guess at this point is that my server was inundated with too much traffic. But it’s a VPS so I don’t know what’s going on. I hope this doesn’t happen again tomorrow –

    • random guy

      You need to get a fully managed cpanel VPS so that someone that knows what they are doing can assist you.

      When you have 5mb of ram left, you are stuffed. The server would be slowing down immensely. From here, upgrading the ram, or installing cpnigix, or having someone fine tune the VPS, can all reduce your ram usage and improve performance.

  40. rookie

    Thank you so much for your help.

    I am just a rookie that had to do this job.

    This helped me:

    1define(‚DB_NAME‘, ‚database-name‘);

    2define(‚DB_USER‘, ‚database-username‘);

    3define(‚DB_PASSWORD‘, ‚database-password‘);

    4define(‚DB_HOST‘, ‚localhost‘);

  41. Gorillaz

    I justed wanted to thank you very much.
    You saved my day.

  42. Luke

    I rebooted my server. Problem solved. You might want to mention that first in the article. Saves time, lol.

    Log into ubuntu 12.04 -> Reboot

    • Jack

      I had this same issue. I rebooted the server, problem resolved but wp-admin panel is running too much slow since i rebooted the server. Any idea?

  43. vanda

    I met a problem , I can’t go to front end it show the message that
    „Error establishing a database connection“ of my page I did it on localhost, what can I do?

  44. WPBeginner Staff

    Jacob, it seems like your database server is frequently down. Contact your web host or switch to a better WordPress Hosting provider.

    As for the facebook issue we will recommend you to use WordPress SEO by Yoast. Once it is activated go to SEO -> Social and check the box next to Add Open Graph meta data.

    • Aaron Winters

      I’m having same issue as Jacob had, but on my local install. In the time it takes to make an edit of any sort, I sporadically get sent to the „Error establishing a database connection“ page. (Only on Admin side) 1 in 5 times it actually forwards past it on its own and completes the update, otherwise I have to copy the entire post, paste over the old, submit over and over until it finally accepts. Also happens on image uploads. No problem on the remote host that I know of.

  45. Jacob Wall

    I get the error sporadically – only when I’m signed into my admin account. Although one blog reader did inform me that once it took her 4 attempts to load the main page. It never lasts long, but happens often (4 or 5 times a day?).

    Also, while I am writing blogs, I will often get a „Connection to server lost“ error, and then I have to wait for it to reconnect before I can save. As I said, it never lasts more than about 15 minutes, but often enough so it makes writing blog posts a very time consuming process.

    Finally, when I try to share on FB, the preview doesn’t show up – only a link. I have know idea if these three errors are related, but they seem to show up around the same time, and all three are too frequent.

  46. Deepika Arodhiya

    I have change my hosting. How to proceed? Getting error:

    Error establishing a database connection

  47. uvraj

    I have anothere issue here.. the posts are working fine. but in the main url, the error „error establishing database connection“ is appearing? Is there something with my theme? I am not able to figure it out…..

  48. JD

    Thank you! Appreciate the post. Worked for me, although had to do a combination of the methods stated!
    Thanks!

  49. zuecell

    all my wp on my host error :( should i check one by one :(

Eine Antwort hinterlassen

Danke, dass du einen Kommentar hinterlassen möchtest. Bitte beachte, dass alle Kommentare nach unseren kommentarpolitik moderiert werden und deine E-Mail-Adresse NICHT veröffentlicht wird. Bitte verwende KEINE Schlüsselwörter im Namensfeld. Lass uns ein persönliches und sinnvolles Gespräch führen.