Topic on Project:Support desk

Jump to navigation Jump to search

Reporting that "(Cannot access the database)" though I can connect via terminal to mysql.

5
Jamiehutber (talkcontribs)

I believe this is not actually a connect issue, as I can see "title-invalid-e" and I can connect with the same credentials found in my LocalSettings.php file.

Any help would be much appreciated.

http://gwart.co.uk/

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

(Cannot access the database)

Backtrace:

#0 /var/www/gwart.co.uk/mediawiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php(753): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /var/www/gwart.co.uk/mediawiki/includes/GlobalFunctions.php(2653): Wikimedia\Rdbms\LoadBalancer->getConnection(0, Array, false)
#2 /var/www/gwart.co.uk/mediawiki/includes/cache/localisation/LCStoreDB.php(54): wfGetDB(-1)
#3 /var/www/gwart.co.uk/mediawiki/includes/cache/localisation/LocalisationCache.php(410): LCStoreDB->get('en', 'deps')
#4 /var/www/gwart.co.uk/mediawiki/includes/cache/localisation/LocalisationCache.php(456): LocalisationCache->isExpired('en')
#5 /var/www/gwart.co.uk/mediawiki/includes/cache/localisation/LocalisationCache.php(375): LocalisationCache->initLanguage('en')
#6 /var/www/gwart.co.uk/mediawiki/includes/cache/localisation/LocalisationCache.php(294): LocalisationCache->loadSubitem('en', 'messages', 'title-invalid-e...')
#7 /var/www/gwart.co.uk/mediawiki/languages/Language.php(2640): LocalisationCache->getSubitem('en', 'messages', 'title-invalid-e...')
#8 /var/www/gwart.co.uk/mediawiki/includes/cache/MessageCache.php(984): Language->getMessage('title-invalid-e...')
#9 /var/www/gwart.co.uk/mediawiki/includes/cache/MessageCache.php(942): MessageCache->getMessageForLang(Object(LanguageEn), 'title-invalid-e...', false, Array)
#10 /var/www/gwart.co.uk/mediawiki/includes/cache/MessageCache.php(884): MessageCache->getMessageFromFallbackChain(Object(LanguageEn), 'title-invalid-e...', false)
#11 /var/www/gwart.co.uk/mediawiki/includes/Message.php(1312): MessageCache->get('title-invalid-e...', false, Object(LanguageEn))
#12 /var/www/gwart.co.uk/mediawiki/includes/Message.php(864): Message->fetchMessage()
#13 /var/www/gwart.co.uk/mediawiki/includes/Message.php(956): Message->toString('text')
#14 /var/www/gwart.co.uk/mediawiki/includes/title/MalformedTitleException.php(49): Message->text()
#15 /var/www/gwart.co.uk/mediawiki/includes/title/MediaWikiTitleCodec.php(297): MalformedTitleException->__construct('title-invalid-e...', '')
#16 /var/www/gwart.co.uk/mediawiki/includes/Title.php(3752): MediaWikiTitleCodec->splitTitleString('', 0)
#17 /var/www/gwart.co.uk/mediawiki/includes/Title.php(378): Title->secureAndSplit()
#18 /var/www/gwart.co.uk/mediawiki/includes/MediaWiki.php(83): Title::newFromURL('')
#19 /var/www/gwart.co.uk/mediawiki/includes/MediaWiki.php(140): MediaWiki->parseTitle()
#20 /var/www/gwart.co.uk/mediawiki/includes/MediaWiki.php(778): MediaWiki->getTitle()
#21 /var/www/gwart.co.uk/mediawiki/includes/MediaWiki.php(517): MediaWiki->main()
#22 /var/www/gwart.co.uk/mediawiki/index.php(42): MediaWiki->run()
#23 {main}
Bawolff (talkcontribs)

it probably is one. Check your mysql is setup to use password based authentication

Jamiehutber (talkcontribs)

Thanks very much @Bawolff for the reply!!

I am able to connect to the mysql with a pass in CLI.

So this means that I cannot connect to the db for some reason, which there is no end to why. Though I could previously without any problems.

But it is certainly not a username/password issue.

Bawolff (talkcontribs)

> I am able to connect to the mysql with a pass in CLI.

Can you connect with the same username/password that MediaWiki is configured to use in LocalSettings.php ? Can you connect to the database when using the sql.php maintenance script from the command line?

Have you upgraded mysql recently? Have you upgraded php recently? Are you using SELinux or similar security tools that might block php from accessing the database (If so, check their logs)?

Jamiehutber (talkcontribs)

Thanks again!!


> Can you connect with the same username/password that MediaWiki is configured to use in LocalSettings.php ?

I can connect with these details

> sql.php

[9c50504668796b7bedf5c5c9] [no req]   Wikimedia\Rdbms\DBConnectionError from line 1195 of /var/www/gwart.co.uk/mediawiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (mysql)

Backtrace:

#0 /var/www/gwart.co.uk/mediawiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php(753): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()

#1 /var/www/gwart.co.uk/mediawiki/maintenance/sql.php(85): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, boolean)

#2 /var/www/gwart.co.uk/mediawiki/maintenance/doMaintenance.php(94): MwSql->execute()

#3 /var/www/gwart.co.uk/mediawiki/maintenance/sql.php(205): require_once(string)

#4 {main}

Which is clearly a connection issue as you say.


> Have you upgraded mysql recently? Have you upgraded php recently?

Very good question, I do believe I downgraded my php version from 7.4 to 7.0.


> Are you using SELinux or similar security tools that might block php from accessing the database (If so, check their logs)?

I have other sites on the same server that is connecting to the DB. Which adds to my confusion.

Reply to "Reporting that "(Cannot access the database)" though I can connect via terminal to mysql."