WAMP, localhost, Mediawiki: Cannot access the database
Mediawiki on localhost
Since 2:42 PM on 14 March 2009, I have run a private wiki for myself on a WAMP stack--6.5 years and counting.
I have never had everything work perfectly right out of the box, but I have never been frustrated for too long. People have solved all of the basic problems more than once, and it has been just a matter of googling around long enough to debug the setup.
All that has changed.
Mediawiki 1.26, WAMPserver 2.5, and WAMPserver 3
Error Messages
Shorter version
Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.
(Cannot access the database)
With debugging and backtracking enabled
Cannot access the database: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ())
Backtrace:
- #0 C:\wamp\www\mediawiki\includes\db\LoadBalancer.php(842): DatabaseBase->reportConnectionError('Unknown error (...')
- #1 C:\wamp\www\mediawiki\includes\db\LoadBalancer.php(537): LoadBalancer->reportConnectionError()
- #2 C:\wamp\www\mediawiki\includes\GlobalFunctions.php(3631): LoadBalancer->getConnection(-1, Array, false)
- #3 C:\wamp\www\mediawiki\includes\User.php(1208): wfGetDB(-1)
- #4 C:\wamp\www\mediawiki\includes\User.php(397): User->loadFromDatabase(0)
- #5 C:\wamp\www\mediawiki\includes\User.php(362): User->loadFromId(0)
- #6 C:\wamp\www\mediawiki\includes\User.php(2459): User->load()
- #7 C:\wamp\www\mediawiki\includes\User.php(1167): User->getToken(false)
- #8 C:\wamp\www\mediawiki\includes\User.php(365): User->loadFromSession()
- #9 C:\wamp\www\mediawiki\includes\User.php(2029): User->load()
- #10 C:\wamp\www\mediawiki\includes\User.php(3204): User->getId()
- #11 C:\wamp\www\mediawiki\includes\MediaWiki.php(627): User->isLoggedIn()
- #12 C:\wamp\www\mediawiki\includes\MediaWiki.php(476): MediaWiki->main()
- #13 C:\wamp\www\mediawiki\index.php(51): MediaWiki->run()
- #14 {main}
- reportConnectionError "Unknown error"
Not a code or configuration problem
Except for a few times when I shot myself in the foot while debugging, the proof that the PHP code base and my configuration are correct is that I can immediately obtain the page I want by reloading the page.
It is only on the first call after a long time (five minutes? ten?) of not accessing the wiki that the problem occurs.