Error connecting to MediaWiki DB when trying to upgrade to version 1.22

I have a MediaWiki installation on a shared host server. This is in version 1.19.1, and I'm trying to upgrade to 1.22.2. The documentation states that this requires a one-step update.

I have done this several times for past updates successfully and follow the previous notes. I installed it in a new directory, 1.22.2, copied the files to LocalSettings.phpand /images/from the working directory to the new active. LocalSettings.phphas records for $wgDBuser, $wgDBpassword, $wgDBadminuserand $wgDBadminpasswordall defined.

I have command line access to the server and tried to start the update process in WikiNew,

php maintenance/update.php

but he answers:

DB connection error: Unknown MySQL server host 'localhost:/tmp/mysql5.sock' (34) (localhost:/tmp/mysql5.sock)

If I do the same in WikiLive, it works. Of course, he does not make any actual update, as I upgrade 1.19.1 to 1.19.1, but the usual message type appears, but with indications that no changes are needed, and it clears the caches. LiviWiki, 1.19, still works.

Thus, the same data for the connection string exists in both copies of LocalSettings.php, both copies maintenance/update.phpaccess the same MySQL database, but one accepts the connection string and the other does not.

Has something changed between 1.19 and 1.22? I searched for “Configuration Changes” in the release notes for 1.20, 1.21, and 1.22, but I don't see instructions for making any changes.

Please, help!

Thank.

+3
source share
2 answers

,

$wgDBserver = "localhost:/tmp/mysql5.sock"

$wgDBserver = "localhost"

, MediaWiki 1.19.2 :

https://bugzilla.wikimedia.org/show_bug.cgi?id=58153

" mysqli 1.22.0 MySQL ".

+2

, MySQL- host:port:socket, localhost:3306:/var/lib/mysock.

mediawiki-1.22.6, . localhost , MySQL , .

php mediawiki-1.22.6, host:port:socket.

: , , , , , localhost:/var/lib/mysock.

, .

IP.php Includes public static function splitHostAndPort( $both ), real_connect() protected function mysqlConnect( $realServer ), DatabaseMysqli.php /db.

splitHostAndPort() :

public static function splitHostAndPort( $both ) {
    if ( substr( $both, 0, 1 ) === '[' ) {
        if ( preg_match( '/^\[(' . RE_IPV6_ADD . ')\](?::(?P<port>\d+))?$/', $both, $m ) ) {
            if ( isset( $m['port'] ) ) {
                return array( $m[1], intval( $m['port'] ) );
            } else {
                return array( $m[1], false );
            }
        } else {
            // Square bracket found but no IPv6
            return false;
        }
    }
    $numColons = substr_count( $both, ':' );
    if ( $numColons >= 2 ) {
        // Is it a bare IPv6 address?
        if ( preg_match( '/^' . RE_IPV6_ADD . '$/', $both ) ) {
            return array( $both, false );
        } else {
            // Not valid IPv6, but too many colons for anything else
            // may be of the form localhost:port:socket
            // return false;
        }
    }
    if ( $numColons >= 1 ) {
        // Host:port:socket?
        $bits = explode( ':', $both );
        if ( preg_match( '/^\d+/', $bits[1] ) ) {
            if ($numColons > 1) {
                return array( $bits[0], intval( $bits[1] ), $bits[2] );
            } else {
                return array( $bits[0], intval( $bits[1] ) );
            }
        } else {
            // Not a valid port
            return false;
        }
    }
    // Plain hostname
    return array( $both, false );
}

mysqlConnect(), , , :

// Other than mysql_connect, mysqli_real_connect expects an explicit port
// parameter. So we need to parse the port out of $realServer
$socketname = $port = null;
$hostAndPort = IP::splitHostAndPort( $realServer );
if ( $hostAndPort ) {
    $realServer = $hostAndPort[0];
    if ( $hostAndPort[1] ) {
        $port = $hostAndPort[1];
    }
    if ( $hostAndPort[2] ) {
        $socketname = $hostAndPort[2];
    }
}

real_connect(),

if ( $mysqli->real_connect( $realServer, $this->mUser,
    $this->mPassword, $this->mDBname, $port, $socketname, $connFlags ) )
0

All Articles