Skip to content

Commit f1374f8

Browse files
author
Till Brehm
committed
Fixed #5225 ISPConfig fails to create ispconfig user during initial installation with MySQL 8.0
1 parent 373a9f2 commit f1374f8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

install/lib/installer_base.lib.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,15 @@ public function add_database_server_record() {
288288
$this->db->query("DROP USER ?@?", $conf['mysql']['ispconfig_user'], $from_host);
289289
$this->db->query("DROP DATABASE IF EXISTS ?", $conf['mysql']['database']);
290290

291-
//* Create the ISPConfig database user in the local database
292-
$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON ?? TO ?@? IDENTIFIED BY ?';
293-
if(!$this->db->query($query, $conf['mysql']['database'] . ".*", $conf['mysql']['ispconfig_user'], $from_host, $conf['mysql']['ispconfig_password'])) {
291+
//* Create the ISPConfig database user and grant permissions in the local database
292+
$query = 'CREATE USER ?@? IDENTIFIED BY ?';
293+
if(!$this->db->query($query, $conf['mysql']['ispconfig_user'], $from_host, $conf['mysql']['ispconfig_password'])) {
294294
$this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage);
295295
}
296+
$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON ?? TO ?@?';
297+
if(!$this->db->query($query, $conf['mysql']['database'] . ".*", $conf['mysql']['ispconfig_user'], $from_host)) {
298+
$this->error('Unable to grant databse permissions to user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage);
299+
}
296300

297301
//* Set the database name in the DB library
298302
$this->db->setDBName($conf['mysql']['database']);

0 commit comments

Comments
 (0)