2

I'm trying to upgrade my MediaWiki installation. My site runs just fine locally at http://localhost:8888/. I can connect to my database using the "Socket" connection on Sequel Pro on port 8888. My database settings in LocalSettings.php look like this:

## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "lifesitedb";
$wgDBuser = "root";
$wgDBpassword = "root";

However, even though everything else seems fine, when I run php update.php in the maintenance directory, I get this error:

MediaWiki 1.33.0 Updater

Your composer.lock file is up to date with current dependencies!
[97ab0d1b306782d836a0662c] [no req]   Wikimedia\Rdbms\DBConnectionError from line 1213 of /Users/Brandon/Sites/LifeSite/site/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)
Backtrace:
#0 /Users/Brandon/Sites/LifeSite/site/includes/libs/rdbms/loadbalancer/LoadBalancer.php(758): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /Users/Brandon/Sites/LifeSite/site/includes/GlobalFunctions.php(2637): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, boolean)
#2 /Users/Brandon/Sites/LifeSite/site/maintenance/Maintenance.php(1375): wfGetDB(integer, array, boolean)
#3 /Users/Brandon/Sites/LifeSite/site/maintenance/update.php(147): Maintenance->getDB(integer)
#4 /Users/Brandon/Sites/LifeSite/site/maintenance/doMaintenance.php(96): UpdateMediaWiki->execute()
#5 /Users/Brandon/Sites/LifeSite/site/maintenance/update.php(266): require_once(string)
#6 {main}

It says it cannot access the database because of an unknown error. What could this possibly be? I'm sure the connection information is correct since the site runs fine and connecting to the database using Sequel Pro works as well. What is going on here?

I'm running PHP 7.1.23 on macOS 10.14.4. I'm using MAMP 5.4 to host MediaWiki locally.

2

I seem to have resolved this by explicitly adding the socket to the $wgDBserver variable in LocalSettings.php. To get the socket path, I ran this query in Sequel Pro:

show variables like 'socket'

The only result was the following:

/Applications/MAMP/tmp/mysql/mysql.sock

So I changed the variable as follows:

$wgDBserver = "localhost:/Applications/MAMP/tmp/mysql/mysql.sock";

The update.php script was then able to connect to the database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.