Hi,
dont know if this is the right thread to post:
I had the same Problem with a freh installation of Froxlor @mysql v8.
Had to rewrite the Installer:
From: (Line 645 to 663)
foreach ($mysql_access_host_array as $mysql_access_host) {
$_db = str_replace('`', '', $this->_data['mysql_database']);
$stmt = $db_root->prepare("
GRANT ALL PRIVILEGES ON `" . $_db . "`.*
TO :username@:host
IDENTIFIED BY 'password'");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host
));
$stmt = $db_root->prepare("SET PASSWORD FOR :username@:host = PASSWORD(:password)");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host,
"password" => $this->_data['mysql_unpriv_pass']
));
}
$db_root->query("FLUSH PRIVILEGES;");
Replace with:
foreach ($mysql_access_host_array as $mysql_access_host) {
//Create User
if (version_compare($version_server, '8.0.11', '>=')) {
$stmt = $db_root->prepare("CREATE USER :username@:host IDENTIFIED BY :password");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host,
"password" => $this->_data['mysql_unpriv_pass']
));
} else {
$stmt = $db_root->prepare("
GRANT ALL PRIVILEGES ON `" . $_db . "`.*
TO :username@:host
IDENTIFIED BY 'password'");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host
));
$stmt = $db_root->prepare("SET PASSWORD FOR :username@:host = PASSWORD(:password)");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host,
"password" => $this->_data['mysql_unpriv_pass']
));
}
}
// Ab dafür (DB -> Rolle -> User)
$stmt = $db_root->prepare("CREATE ROLE 'Froxlor_Role'");
$stmt->execute();
$stmt = $db_root->prepare("GRANT ALL ON `" . $_db . "`.* TO 'Froxlor_Role'");
$stmt->execute();
foreach ($mysql_access_host_array as $mysql_access_host) {
$stmt = $db_root->prepare("GRANT Froxlor_Role TO :username@:host");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host
));
}
foreach ($mysql_access_host_array as $mysql_access_host) {
$stmt = $db_root->prepare("SET DEFAULT ROLE Froxlor_Role TO :username@:host");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host
));
}
if (version_compare($version_server, '8.0.11', '<')) {
$db_root->query("FLUSH PRIVILEGES;");
}
Some Info´s:
- I have used MySQL Roles
- Add User with GRANT only does not work anymore
- FLUSH PRIVILEGES is also obsolete.
For sure there are some possibilities to finetune some of the code.
hf with it