Jump to content

Topic on Project:Support desk

MW can't connect to DB though the install script can

6
2A01:CB19:8142:6C00:1CCF:B57E:64A0:D6E5 (talkcontribs)

This is what I did:

1. Create a new MySQL database 'blah_mw' and a user 'blah_user' with all possible privileges on the former.

2. Install MediaWiki, providing the following information to the installation script:

$wgDBtype = 'mysql';
$wgDBserver = 'localhost';
$wgDBname = 'blah_mw';
$wgDBuser = 'blah_user';
$wgDBpassword = 'mynicepassword';

as summed up in LocalSettings.php.

3. Go to http://mywiki.org/, where I obtain the error:

MediaWiki internal error.
 
 Original exception: [ZqEs3UQYlJ7QKxMlbf02vgAAAIA] /   Wikimedia\Rdbms\DBConnectionError: Cannot access the database: Access denied for user 'blah_user'@'localhost' (using password: YES) (localhost)
 Backtrace:
 from /home/blah/public_html/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1138)
 #0 /home/v/public_html/includes/libs/rdbms/loadbalancer/LoadBalancer.php(794): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
 #1 /home/blah/public_html/includes/libs/rdbms/loadbalancer/LoadBalancer.php(782): Wikimedia\Rdbms\LoadBalancer->getServerConnection()
 #2 /home/blah/public_html/includes/libs/rdbms/database/DBConnRef.php(99): Wikimedia\Rdbms\LoadBalancer->getConnectionInternal()
 #3 /home/blah/public_html/includes/libs/rdbms/database/DBConnRef.php(117): Wikimedia\Rdbms\DBConnRef->ensureConnection()
 #4 /home/blah/public_html/includes/libs/rdbms/database/DBConnRef.php(338): Wikimedia\Rdbms\DBConnRef->__call()
 #5 /home/blah/public_html/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(747): Wikimedia\Rdbms\DBConnRef->selectField()

It seems that MediaWiki cannot connect to the database. However, when I open it with PHPmyadmin, I can see that the installation script has been able to edit it, so the problem is not related to the credentials I gave.

Does anybody have any clue what the problem can be related to?

Bawolff (talkcontribs)

When you say install script do you mean install.php commandline script or do you mean web installer?

2A01:CB19:8142:6C00:F65B:F11B:9B75:993D (talkcontribs)

I mean the web installer.

2A01:CB19:8142:6C00:F65B:F11B:9B75:993D (talkcontribs)

I should also mention that I use a shared hosting, so I don't have root privileges on the server. The creation of the database and MySQL user were done through the administration panel of the host, and then I downloaded MediaWiki by SSH.

Bawolff (talkcontribs)

That's weird. If it works in one it should work in both.

Try using wgDBServer of 127.0.0.1 instead of localhost, just in case (controls whether to use tcp or unix socket)

2A01:CB19:8142:6C00:679:E05E:1051:3B2A (talkcontribs)

Finally it worked by creating a second user. Apparently my host blocked the first one, probably the web installer had it make too many inserts into the database... Sorry for bothering, thanks a lot for your answers.

Reply to "MW can't connect to DB though the install script can"