Jump to content

Topic on Project:Support desk

Cannot access the database: No such file or directory (localhost)

4
2601:193:8302:1FA5:25FB:ECB7:D3E4:CD04 (talkcontribs)

I am running Mediawiki in a Docker container with a separate MySQL container as the DB. I have set up my DB via the install wizard but no matter what I do I get the Cannot access the database: No such file or directory (localhost) error.

I am positive my settings for Mediawiki are all correct but I still will have the localhost error. It even says localhost when my DB is NOT on localhost. Are there any known issues for using Mediawiki in a Docker Container? I have the containers linked and both can talk to each other. I can access the db from the browser using a DB connection test script on the mediawiki container. The mysql client can also connect just fine from the mediawiki container.

Also why does it say localhost when it's not a local db?

Thanks,

Gerdesj (talkcontribs)

Your Localsettings.php should have settings like this in it:

$wgDBtype = "mysql";

$wgDBserver = "localhost";

$wgDBname = "mediawiki";

$wgDBuser = "mediawiki";

$wgDBpassword = "mediawiki";

I suspect that your $wgDBserver is not set correctly.

Ciencia Al Poder (talkcontribs)

Or maybe you had a typo when specifying $wgDBserver and the wiki is using the default value. Be sure the case is correct.

2601:193:8302:1FA5:25FB:ECB7:D3E4:CD04 (talkcontribs)

SOLVED THE ISSUE! :)

my docker-entrypoint.sh file was setting the wgDBserver value in the LocalSettings.php file but it had a typo in a sed command. :P

Thanks for your help you made the difference so I could find the typo!