diff options
| author | 2023-03-05 18:00:04 +0100 | |
|---|---|---|
| committer | 2023-03-05 18:00:04 +0100 | |
| commit | 16472fd427a4058811784d49228e074ddbb7bead (patch) | |
| tree | 12f7da6b1839284871c4efe12fcf2b09e0a0cdd7 /lib | |
| parent | 068d18b69bae8456669293a8b7dfe9afd827e03d (diff) | |
Fix MySQL UNIX socket support (#5166)
MySQL uses different parameters for passing UNIX socket pathts
(unix_socket) and TCP sockets (host) in contrast to PosgreSQL which uses
one for both (host).
Signed-off-by: Konrad Gräfe <kgraefe@paktolos.net>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/ModelPdo.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 85796b53a..3bcf87247 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -51,7 +51,13 @@ class Minz_ModelPdo { switch ($db['type']) { case 'mysql': - $dsn = 'mysql:host=' . (empty($dbServer['host']) ? $db['host'] : $dbServer['host']) . ';charset=utf8mb4'; + $dsn = 'mysql:'; + if (empty($dbServer['host'])) { + $dsn .= 'unix_socket=' . $db['host']; + } else { + $dsn .= 'host=' . $dbServer['host']; + } + $dsn .= ';charset=utf8mb4'; if (!empty($db['base'])) { $dsn .= ';dbname=' . $db['base']; } |
