WordPress Xampp Error Establishing A Database Connection

Problem bei XAMPP – Warten auf localhost.

Bei einer Testinstallation von WordPress auf dem eigenen Computer mittels XAMPP stellten sich unerwartet Probleme ein: Beim Aufruf der WP-Installation (localhost/wordpress/wp-admin/install.php) kam entweder die Fehlermeldung "Error establishing a database connection", oder es kamen Fehlermeldungen während des unendlich lange dauernden Installationsprozesses, Hinweise, dass die Datenbank repariert werden müsse, nur halb aufgebaute Seiten. und immer die Einblendung in der Statusleiste des Browsers: Warten auf localhost.

Von der berühmten 5-Minuten-Installation konnte keine Rede sein. Fünf Stunden hat es gedauert, bis ich endlich den Fehler finden konnte. Dabei hatte ich mich eigentlich längst von XAMPP verabschiedet, weil sich vor einigen Jahren bereits Probleme mit der Geschwindigkeit eingestellt hatten, die ich damals nicht ergründen konnte. Für die Einführung "WordPress testen: Installation auf der eigenen Festplatte" wollte ich aber die dort beschriebenen Installationsschritte mit aktuellen Versionen von XAMPP und WordPress durchspielen – um wieder auf diese elenden Timingprobleme zu stoßen.

Um’s kurz zu machen: Die Lösung ist ein simpler Eintrag in der wp-config.php von WordPress:

define(‘DB_HOST’, ‘127.0.0.1:3306‘);

Viele, die sich mit dem Sinn dieses Eintrags auskennen, werden nun die Nase rümpfen. Und genau diese Haltung findet sich auch in zahlreichen Postings zu diesem Thema im Internet, was eine Lösung des Problems, das seit Jahren bei vielen Windows- und auch Mac-Usern immer wieder auftaucht, behinderte. Dabei ist die Skepsis auf den ersten Blick berechtigt:

Bei einer WordPress-Installation werden in der wp-config.php üblicherweise nur drei Eintragungen vorgenommen: der Name der Datenbank, in der WordPress die Daten ablegen soll, außerdem der Name des Users, also des Zugriffsberechtigten der Datenbank, und das zugehörige Passwort.

Der Eintrag für DB_HOST wird in der Regel nicht geändert. Dort localhost gegen 127.0.0.1:3306 auszutauschen, ist scheinbar überflüssig, denn der ‘well known’ Hostname localhost sagt ja nichts anderes, als dass die Host-IP 127.0.0.1 über den Standard-Port 3306 benutzt werden soll. Allerdings: Das Betriebssystem muss WordPress diesen Zusammenhang mitteilen, und zwar jedesmal, wenn WordPress auf die Datenbank zugreifen will. Und genau hier liegt der Hase begraben oder der Hund im Pfeffer oder so. egal. Verwirrenderweise tritt das Problem nur bei manchen Betriebssystemen auf, vor allem bei Windows 7 und eventuell auch Windows 8, vermutlich inzwischen nicht mehr bei neueren Macs mit Linuxgrundlage.

In manchen Windows-Konstellationen jedenfalls wird wohl ein Domain-Name-Service bemüht, offenbar in Form eines externen DNS-Lookups, um den Namen localhost in die IP aufzulösen. Windows sucht also lustig im Internet herum, was denn wohl localhost bedeuten könne. Und das kann dauern (vor allem, wenn gar keine Internetverbindung aufgebaut ist, weil man ja XAMPP aufgesetzt hat, um lokal zu arbeiten). Eigentlich sollte hierfür eine interne Tabelle ausreichen, die Datei C:\Windows\System32\drivers\etc\hosts scheint hierfür vorgesehen zu sein. Bei mir allerdings (win 7, 64bit) sind die entsprechenden Einträge dort wegkommentiert, also wirkungslos.

Fazit: Erst mit der geringfügigen Änderung in der Konfigurationsdatei von WordPress war mein PC überhaupt in der Lage, die Installation fehlerlos abzuschließen. Während sie vorher mit der Meldung "Error establishing a database connection" gar nicht erst startete oder nur unvollständig abschloss (entweder waren nicht alle Tabellen angelegt oder diese nicht komplett befüllt worden), lief sie nach der DB_HOST-Konkretisierung so schnell und problemlos durch, wie ich das lokal vom UniServer und auch durch Internet-Installationen kenne.

Nach der Installation unter XAMPP funktioniert der Seitenaufbau nun übrigens auch mit der Voreinstellung DB_Host=localhost. Das Laden einer Testseite benötigt dann aber 22 Sekunden! Stelle ich wieder um auf meine Lösung, dauert der Seitenaufbau weniger als 500ms. Diesen kleinen Test hab ich dann auch noch bei einer WP-Installation unter dem Uniform Server gemacht, bei dem die Installation auch mit der localhost-Einstellung problemlos durchläuft: Seitenaufbau per localhost: 1,3 Sekunden, mit 127.0.0.1:3306 nur noch 0,8 Sekunden.

WordPress MU

The MU forums have moved to WordPress.org

How to install wordpress-mu locally with XAMPP?pls help (27 posts)

Taradeiv
Member
Posted 10 years ago #

Randomly i searched for installation procedure and did the following.

1. I included 127.0.0.1 localhost.localdomain in the windows host file.
2. I dint create any wp-config.php file.

then i followed the normal procedure like wordpress installation.

http://localhost.localdomain/wordpress-mu/index.php when i give this, I get ERROR IN DATABASE CONNECTION.

can anyone make the procedure clear for me?

Did it create a database?

Taradeiv
Member
Posted 10 years ago #

yes, database was created. n it exists now.

MrBrian
Member
Posted 10 years ago #

paste your config’s database details

Taradeiv
Member
Posted 10 years ago #

Hi brian!
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress-mu’);

/** MySQL database username */
define(‘DB_USER’, ‘wordpress’);

/** MySQL database password */
define(‘DB_PASSWORD’, ”);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost.localdomain’);

/** Database Charset to use in creating database tables. */
define(‘DB_CHARSET’, ‘utf8’);

/** The Database Collate type. Don’t change this if in doubt. */
define(‘DB_COLLATE’, ”);
define(‘VHOST’, ‘yes’);
$base = ‘/wordpress-mu/’;
define(‘DOMAIN_CURRENT_SITE’, ‘localhost.localdomain’ );
define(‘PATH_CURRENT_SITE’, ‘/wordpress-mu/’ );
define(‘BLOGID_CURRENT_SITE’, ‘1’ );

this is the DB details in the config file

cafespain
Member
Posted 10 years ago #

Hmmm. Not had much experience with XAMPP, but does it put the mysql database at a none standard port?

Try changing the DB_HOST to 127.0.0.1 and see what happens?

"/** MySQL database password */
define(‘DB_PASSWORD’, ”);"

You DID set a password, right? And you just removed it for showing us, yes?

pumpkinpatch
Member
Posted 10 years ago #

I say ditch the old database, create a new one. Using xampp phpmyadmin, create a new database and user. This time with a proper password as Andrea mentions. Root with no pw is xampp default, and looks like you created user ‘wordpress’- but did you set a pw? Put in those values into your wpconfig file and you should be good to go.
define(‘DB_HOST’, ‘localhost’);

Taradeiv
Member
Posted 10 years ago #

Hi all! I’ve changed the DB host to local host, set a password. still, it says ERROR in establishing DATABASE connection.

and MySQL runs in a standard port 3306.

can anyone pls put down the exact steps ?

pumpkinpatch
Member
Posted 10 years ago #

I suggest you start with a simple trial setting:

define(‘DB_NAME’, ‘tara’);
define(‘DB_USER’, ‘tara’);
define(‘DB_PASSWORD’, ‘tara’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);
define(‘VHOST’, ‘yes’);
$base = ‘/’;
$table_prefix = ‘wp_’;

Then using phpmyadmin, check if the database had been populated with WP tables. Remember to put in the right locations in the hosts file, and set vhost. MySQL is running, right?
If you still have problems, cut and post your entire config file here (please remove the comments and extra lines to keep it short and clear), and your hosts file.
phpmyadmin:
http://localhost/phpmyadmin/ or http://urwebsitename.tld/phpmyadmin

Taradeiv
Member
Posted 10 years ago #

define(‘DB_COLLATE’, ”);
define(‘VHOST’, ‘yes’);
$base = ‘/wordpress-mu/’;
define(‘DOMAIN_CURRENT_SITE’, ‘localhost.localdomain’ );
define(‘PATH_CURRENT_SITE’, ‘/wordpress-mu/’ );
define(‘BLOGID_CURRENT_SITE’, ‘1’ );

I want to make few things clear.Above is the automatically created config file in the process of installing.

I tried to create new user,n database with password. like user-tara, database-tara,password-user1

n then installed. finally,I got Error in establishing connection . After this, i deleted the config file.

created new user:wordpress,new pwd:user1,database:wordpress in phpadmin.

Then started installing.It automatically asked for config file details. I gave the same. It got installed. immediate step was to login, I got the same error again. 🙁

pls,help me with this.

pumpkinpatch
Member
Posted 10 years ago #

I’m not sure I understand, but are you using the username/password combo that is displayed after WPmu gets installed and connected to the db?
Username usually is admin, password is some random string. Do you get to that page?

cafespain
Member
Posted 10 years ago #

Can you log in to the database in phpmyadmin using the username and password that you are entering for the installation?

Can you view the tables in there?

Can you create a table?

Can you run a select query to get the results from the query?

If you can’t do any of these then we can narrow down the problem. It may be permissions on the database.
When you added the users, you did assign them permissions to the databases didn’t you? And flush the privileges afterwards.

Taradeiv
Member
Posted 10 years ago #

yeah i get those default UN:admin and random password.After that when i log in , it says ERROR IN DATABASE CONNECTION.

Taradeiv
Member
Posted 10 years ago #

Yeah i can access the database after that. view the table and all. and the user which was given al permissions

pumpkinpatch
Member
Posted 10 years ago #

You could try and do some SELECT and stuff. If not, why not just delete xampp and start over? Only takes a few minutes.
You did remember to set vhosts and hosts (in Windows), right?

conpeo
Member
Posted 10 years ago #

if Windows, I suggest u try WAMPserver.

I was using WAMP+WPMU, it works perfect in XP.

Few weeks ago, I encounterd similar issue in XAMPP, but MAMP was Ok. so I suspect .

WPMU works perfect on XAMPP. On windows machine you have to edit the etc file. It’s located at C:\windows\system32\drivers\etc

Open it with notepad and ad a new line
127.0.0.1 yoursite.loc

then go to http://yoursite.loc and install wordpress mu. It works perfect for me.

Taradeiv
Member
Posted 10 years ago #

I tried reinstalling XAMPP n did everything again. result was the same error!

before trying with WAMP. I would like to try again.

can u just tell me the exact steps to install WPMU locally with XAMPP? can u just write down the exact steps?? htis would be useful n more clear for me.

@my_gude_org. that line doesnt make any difference.

I’ll try with WAMP, if XAMPP doesnt work in my next trial.Thanku!

pumpkinpatch
Member
Posted 10 years ago #

The instructions are for Win/Vista:
1) Download xampp and install in the default directory xampp.
2) Some User account settings have to be changed for Vista, Google it. Don’t remember what it is.
3) Upack WPmu into c:xampp/htdocs
4) Edit apache\conf\httpd.conf
Make sure the following line is present/uncommented
LoadModule rewrite_module modules/mod_rewrite.so
5) Edit c:\xampp\apache\conf\extra\httpd-vhosts.conf, add:
NameVirtualHost *:80

ServerAdmin something@localhost
DocumentRoot "C:/xampp/htdocs"
ServerName yourdomainname.tld
ServerAlias *.yourdomainname.tld
ErrorLog logs/error.log
CustomLog logs/access.log common

6) Edit c:\Windows\System32\drivers\etc\hosts, adding
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 subdomain1.yourmudomain.tld
127.0.0.1 subdomain2.yourmudomain.tld
127.0.0.1 subdomain3.yourmudomain.tld
All MU subdomains have to be explicitly named
7) Point your browser to http://localhost/localdomain/phpmyadmin. Using phpmyadmin, create a database, user/password (with all privileges).
8) In your browser, go to http://localhost.localdomain
9) WPmu installation page will load up. Put in all the database details and other stuff mentioned in earlier posts. In earlier posts, I made a mistake by implying that you manually add some lines in wpconfig. This is wrong (that applies only to plain WP).
10) If everything works out, you will land on the login page of http://yourWPmudomain.tld

This is all from memory, did this a long time back. Things might have changed since then. Your experience might vary. Batteries not included. Not suitable for children below 3. :))

MrBrian
Member
Posted 10 years ago #

Pretty detailed instructions for being from memory. Nice job!

Say hello to your favorite applications on XAMPP.

Quickly install dozens of Bitnami Modules on top of the XAMPP server stack.

Bitnami Modules can be easily installed on your XAMPP server stack.

What are Bitnami Modules?

Bitnami Modules are production-ready packages of the most popular open source applications, available in the widest variety of formats.

Dozens of Bitnami open source applications can be quickly and easily installed on top of your XAMPP server or deployed in the cloud — for a broad range of use cases from blogs to ecommerce, business automation to eLearning.

By using a Bitnami package, you’ll get the added benefits of optimizations for performance, the most up-to-date releases, and security patches as soon as they’re available.

Get started by selecting a Bitnami Module for XAMPP below.

Need to customize XAMPP? Customize, package and maintain your apps in the cloud with Bitnami Stacksmith. Try it now

25 Bitnami Modules for XAMPP and counting.

Click on an app to start your download, then follow the installation instructions.

Windupurnomo’s Blog

catatan kecil, reminder, digital history..

Mengatasi Error Apache XAMPP

Ada banyak penyebab error yang terjadi pada apache xampp. Yang akan saya tulis di sini adalah error yang terjadi karena “path to executable” service apache nya salah. Kesalahan ini biasanya terjadi karena memindahkan xampp ke lokasi lain. Misalkan saya merasa tidak nyaman xampp yang berada di drive C, kemudian xampp itu saya pindahkan ke drive E (uninstall xampp, kemudian install lagi dengan mengatur xampp agar terinstal di drive E).
Error yang disebabkan semacam ini dapat diatasi dengan cara merubah path apche yang akan dieksekusi ke path apche yang baru.

  1. Buka registry editor: start > run > ketik: regedit > ok
  2. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.2 (asumsi: service yang akan dirubah adalah Apache2.2)
  3. Klik kanan ImagePath pilih Modify
  4. Ubah value data
    before: “C:\xampp\apache\bin\apache.exe” -k runservice
    after: “E:\xampp\apache\bin\apache.exe” -k runservice
  5. OK

Sekarang coba jalankan lagi apache, mudah-mudahan berhasil.

Share this:

Post navigation

Leave a Reply Cancel reply

mas mohon bantuan. kai mengalami trouble XAMPP. XAMPP ini kami pakai untuk menggerakkan program perspustakaan SENAYAN.
peringatan yang muncul sbb:

Warning:mysqli::query ()[mysqli.query]:(HY000/1194):Table ‘mst_module’ is marked as crashed and should be repaired in C:\XAMPP\htdocs\senayan\lib\admin_logon.inc.php on line 90

Fatala Error: call to a member function fetch_assoc() on a non-object in C;\Xampp\htdocs\senayan\admin_logon.inc.php on line 91

pertanyaan saya:
1. Bagaimana cara memerbaikinya? memngingat kami awam soal XAMPP ini. org yang negerti soal ini sudah keluar dari tempat kerja kami. mohon bantuannya
2. apakah install ulang XAMPP jauh lebih baik dan mudah dan nantinya tidak akan menimbulkan permasalahan yang sama?
3. apakah instalasi ulang tidak memengaruhi data base yang ada? Program aplikasi perpustakaan SENAYAN yang kami pakai berbasis mysql
4. apa yang menyebabkan terjadinya error ini?

kalau tidak memberatkan, jawaban bisa dikirimkan ke email saya: bayugunawan@gmail.com

terimakasih atas bantuannya

Dari pesan error yang disampaikan, yang harus dilakukan adalah merepair tabel mst_module. Cara merepair itu gampang,
1. Aktifkan XAMPP Control Panel (Start -> all Programs -> XAMPP)
2. Pastikan Apache dan MySQL sudah berjalan/start (warna hijau)
3. Masuk ke browser, kemudian masukan: http://localhost/phpmyadmin
4. Pilih database yang anda gunakan
5. Check list, tabel mst_module
6. Kemudian, dibawah ada combo box (With Selected:), pilih: REPAIR

Proses ini tidak akan menghapus data, tapi untuk berjaga2 silahkan dibackup saja datanya.

Assalamualaikum mas terimakasih banyak… mudah2an cita2nya tercapai dan mendapatkan Ridho dari Allah… Amin……

FIX Error establishing a database connection on wordpress cpanel sites

Presupuesto R100-210 ZAR

  • Freelancer
  • Trabajos
  • HTML
  • FIX Error establishing a database connection on wordpress cpanel sites

This error should be fixed on [login to view URL]

Should be an easy fix

Nº del proyecto: #16279421

Buscando hacer algo de dinero?

Establece tu presupuesto y plazo

Describe tu propuesta

Consigue pago por tu trabajo

Es gratis registrarse y ofertar en los trabajos

Hi i am linux administrator and having sound knowledge of wordpress to fix the database error as soon as possible. I am having 5+ year of working experience in this field. see my web as well : [login to view URL] Más

43 freelancers están ofertando el promedio de R202 para este trabajo

Hi there, I can fix this let me know if you are here again Do you have ftp and wp-admin thanks Poonam

Hello, I am highly interested to fix database connection error on your wordpress websites. I have 350+ reviews with 100% completion rate from clients worldwide. Awaiting for you positive reply. Thanks & Regards.

is this errors comes and goes by itself? or permanently there? usually sql cant bear load. if it comes and goes.

Hello there, As per my understanding you need a error should be fixed on existing web page. Please ping me for discuss more about the project, Please check my recent work. [login to view URL] htt Más

Greetings from Webs-cybernetics, Hello, I have gone through your requirement. We have an expertise in WordPress(CMS) designing and Customizations. I can Fix Errors in your Website and provide you in your time line an Más

first we will check all through the cpanel then we will confirm about this work so its only a initial bid please check our profile for past work thanks

Hi there, I’m Zahidul from Bangladesh. I hope you are doing well 🙂 I’ve carefully read your project description. I am very interested in doing this project. If you want I’ll start this project right now. Más

Hello, My name is Lakhan, I have a vast working experience in website development and i will do your work FIX Error establishing a database connection on wordpress cpanel site. Thanks

Hello Sir, i m ready to fix it now, please provide me hosting cpanel details. you will get fixed within 1-2 hours. Please take a look my Portfolio https://www.freelancer.com/u/rajdesign2009 Please see our s Más

WE CAN START YOUR PROJECT IMMEDIATELY. Hello, I gone through your project description which you have given and Our team is very much comfortable in such project. Our organization is a pioneer in the field of Web A Más

Please share with me an admin and cpanel access? I am ready to start work asap. I assure you I will fix it within your timeframe? I have been working as a WordPress Developer since 8+ years. Thanks Ambie Más

HI, Please share hosting access so that we can fix this issue, you want award this project post fix done, we are open for this, Please let me know when we can discuss and start on this project.

Hi, Checked the issue from your provided URL. Interested to fix this issue. I can start right away. Thanks.

Hello, i have read your project description. ready to fix that wordpress error i know its wp-config issue i can fix that in next few hours waiting for your reply to get started. regards, Ameer

Hi, I can fix the error with database connection. Looking forward to discussing the requirements with you. Vikram

Leave a Reply

Your email address will not be published. Required fields are marked *