diff options
Diffstat (limited to 'lib/install.lib.php')
-rw-r--r-- | lib/install.lib.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/install.lib.php b/lib/install.lib.php index a889d65d..899e4925 100644 --- a/lib/install.lib.php +++ b/lib/install.lib.php @@ -155,9 +155,13 @@ function install_insert_db($db_user = null, $db_pass = null, $overwrite = false) // Check to see if we should create a user here if (strlen($db_user) && strlen($db_pass)) { - $sql = 'GRANT ALL PRIVILEGES ON `' . Dba::escape($database) . '`.* TO ' . - "'" . Dba::escape($db_user) . "'@'" . Dba::escape(Config::get('database_hostname')) . "' IDENTIFIED BY '" . Dba::escape($db_pass) . "' WITH GRANT OPTION"; - + $db_host = Config::get('database_hostname'); + if (strpos($db_host, '/') === 0) { + $db_host = 'localhost'; + } + $sql = 'GRANT ALL PRIVILEGES ON `' . Dba::escape($database) . '`.* TO ' . + "'" . Dba::escape($db_user) . "'@'" . Dba::escape($db_host) . "' " . + "IDENTIFIED BY '" . Dba::escape($db_pass) . "' WITH GRANT OPTION"; if (!Dba::write($sql)) { Error::add('general', sprintf(T_('Error: Unable to Insert %1$s with permissions to %2$s on %3$s %4$s'), $db_user, $database, $hostname, Dba::error())); return false; |