Merge pull request #20984 from owncloud/fix-mysql-setup-unix-socket-master
Add unix_socket support for mysql during initial installation - fixes…
This commit is contained in:
commit
9f4ceef7c9
|
@ -89,15 +89,28 @@ class MySQL extends AbstractDatabase {
|
|||
* @throws \OC\DatabaseSetupException
|
||||
*/
|
||||
private function connect() {
|
||||
$type = 'mysql';
|
||||
|
||||
$connectionParams = array(
|
||||
'host' => $this->dbHost,
|
||||
'user' => $this->dbUser,
|
||||
'password' => $this->dbPassword,
|
||||
'tablePrefix' => $this->tablePrefix,
|
||||
);
|
||||
|
||||
// adding port support
|
||||
if (strpos($this->dbHost, ':')) {
|
||||
// Host variable may carry a port or socket.
|
||||
list($host, $portOrSocket) = explode(':', $this->dbHost, 2);
|
||||
if (ctype_digit($portOrSocket)) {
|
||||
$connectionParams['port'] = $portOrSocket;
|
||||
} else {
|
||||
$connectionParams['unix_socket'] = $portOrSocket;
|
||||
}
|
||||
$connectionParams['host'] = $host;
|
||||
}
|
||||
|
||||
$cf = new ConnectionFactory();
|
||||
return $cf->getConnection($type, $connectionParams);
|
||||
return $cf->getConnection('mysql', $connectionParams);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue