Topic on Project:Support desk

[RESOLVED] even with correct database credential I get "Sorry! This site is experiencing technical difficulties"

9
109.171.137.211 (talkcontribs)

Dear Mediawiki developpers,

I'm using Mediawiki version 1.21.2, mysql version 14.14 and php version 5.3.3

I have a "Sorry! This site is experiencing technical difficulties" issue.

As you advised in : http://www.mediawiki.org/wiki/Project:Support_desk/Sections/Database#Sorry.21_This_site_is_experiencing_technical_difficulties.

I checked my database credentials, and they are correct since I can connect locally to my database with:

mysql -u root -p

and

mysql -u mdcons -p

I entered debug lines in my index.php as you advised in : http://www.mediawiki.org/wiki/Manual:How_to_debug#SQL_errors

but I can't understand the error messages and how to fix them. Could you please have a look to the page ? The url is :

https://www.molnac.unisa.it/BioTools/mdcons/index.php

Thanks in advance for your kind advices,

88.130.88.87 (talkcontribs)

Hi!

Your site displays this error:

Can't contact the database server: Unknown database 'mdcons' (localhost))

Backtrace:

#0 /var/wwws/BioTools/mdcons/includes/db/LoadBalancer.php(726): DatabaseBase->reportConnectionError('Unknown error (...')
#1 /var/wwws/BioTools/mdcons/includes/db/LoadBalancer.php(492): LoadBalancer->reportConnectionError()
#2 /var/wwws/BioTools/mdcons/includes/GlobalFunctions.php(3499): LoadBalancer->getConnection(-2, Array, false)
#3 /var/wwws/BioTools/mdcons/includes/objectcache/SqlBagOStuff.php(139): wfGetDB(-2)
#4 /var/wwws/BioTools/mdcons/includes/objectcache/SqlBagOStuff.php(225): SqlBagOStuff->getDB(0)
#5 /var/wwws/BioTools/mdcons/includes/objectcache/SqlBagOStuff.php(200): SqlBagOStuff->getMulti(Array)
#6 /var/wwws/BioTools/mdcons/includes/cache/MessageCache.php(315): SqlBagOStuff->get('mdcons:messages...')
#7 /var/wwws/BioTools/mdcons/includes/cache/MessageCache.php(710): MessageCache->load('en')
#8 /var/wwws/BioTools/mdcons/includes/cache/MessageCache.php(650): MessageCache->getMsgFromNamespace('Mainpage', 'en')
#9 /var/wwws/BioTools/mdcons/includes/Message.php(720): MessageCache->get('mainpage', true, Object(Language))
#10 /var/wwws/BioTools/mdcons/includes/Message.php(464): Message->fetchMessage()
#11 /var/wwws/BioTools/mdcons/includes/Message.php(553): Message->toString()
#12 /var/wwws/BioTools/mdcons/includes/Title.php(370): Message->text()
#13 /var/wwws/BioTools/mdcons/includes/Wiki.php(89): Title::newMainPage()
#14 /var/wwws/BioTools/mdcons/includes/Wiki.php(130): MediaWiki->parseTitle()
#15 /var/wwws/BioTools/mdcons/includes/Wiki.php(538): MediaWiki->getTitle()
#16 /var/wwws/BioTools/mdcons/includes/Wiki.php(458): MediaWiki->main()
#17 /var/wwws/BioTools/mdcons/index.php(62): MediaWiki->run()
#18 {main}

Please make sure that the database name you provided in LocalSettings.php ("mdcons") is correct. And make sure that this DB is fine: The MySQL user, which you provided in LocalSettings.php, should be able to access it!

Florianschmidtwelzow (talkcontribs)

> I entered debug lines in my index.php as you advised in

The advise is to add these lines in your LocalSettings.php not in your index.php. Please do not change other files, read more about it here.

The problem itself, i support the answer of 88.130.88.87. If the database exist (and you are sure about this), make sure, that your database server is the correct one :)

88.130.88.87 (talkcontribs)

Florian, don't you think that the error message is misleading, if not even wrong? When it says that the server could not be contacted, then this sounds like "The server was not online/was not reachable at all." However, the second part of the message, "Unknown database xxx", implies that MediaWiki knows that inside the server the database did not exist. This again means that the server could be contacted (otherwise you wouldn't be able to know that the DB did not exist) and that it responded with "DB does not exist". So in fact MediaWiki could contact the server.

This error message should be improved!

Florianschmidtwelzow (talkcontribs)

Can't contact the database server: <-- this part is hardcoded and apperas every time there is a database error.

Unknown database 'mdcons' (localhost)) <-- This is the message of MySQL (db connection error)

So, yes, the connection to the server itself could be established, but the database doesn't exist. But some installation has two or more servers, maybe one testserver (for example beta labs) to test new things and the production one (i run this installation for example). In this case, the username and password of the DB servers can be the same (and the db name, too), but maybe the database isn't created on one of the servers. Or it's a problem of the hoster, or or or :) So, if the database is really created on the server and MW gives this error, i would check the datababase server :)

88.130.88.87 (talkcontribs)

Yeah, my point is: When MediaWiki knows that the DB does not exist, then it is untrue that it could not connect to the server. This first part of the error message then just is wrong.

It would be better, if the hardcoded part only said something like: "There has been a problem with the database:" And then the MySQL error tells the details. While it is not necessarily so that the DB server cannot be contacted, a "problem" is always present when this error happens.

A wording like that would be better.

Florianschmidtwelzow (talkcontribs)
109.171.137.211 (talkcontribs)

Dear Mediawiki developpers,

Thanks so much by your quick and relevant answers, I'm really impressed ! Yes, you were right there was an issue with mysql database, this has nothing to do with Mediawiki. I just fixed it, Glad also to have unintentionnally improved Mediawiki by contributing to a bug ^^

My best wishes, Edrisse

88.130.65.30 (talkcontribs)

Hi Florian,

I just now saw your changeset. Yes, definitely better! Take this as a +1, please! :-)

Reply to "[RESOLVED] even with correct database credential I get "Sorry! This site is experiencing technical difficulties""