Commit 506d1d5e authored by Florian Schaal's avatar Florian Schaal

Merge branch 'stable-3.1' of http://git.ispconfig.org/ispconfig/ispconfig3 into stable-3.1

parents 45005c30 41dd8eb9
......@@ -686,8 +686,26 @@ class mysql_clientdb_plugin {
}
if($data['new']['database_password'] != $data['old']['database_password'] && $data['new']['database_password'] != '') {
$link->query("SET PASSWORD FOR '".$link->escape_string($data['new']['database_user'])."'@'$db_host' = '".$link->escape_string($data['new']['database_password'])."';");
$app->log('Changing MySQL user password for: '.$data['new']['database_user'].'@'.$db_host, LOGLEVEL_DEBUG);
$result = $app->db->queryOneRecord("SELECT VERSION() as version");
$dbversion = $result['version'];
// mariadb or mysql < 5.7
if(stripos($dbversion, 'mariadb') !== false || version_compare($dbversion, '5.7', '<')) {
$query = sprintf("SET PASSWORD FOR '%s'@'%s' = '%s'",
$link->escape_string($data['new']['database_user']),
$db_host,
$link->escape_string($data['new']['database_password']));
$link->query($query);
}
// mysql >= 5.7
else {
$query = sprintf("ALTER USER IF EXISTS '%s'@'%s' IDENTIFIED WITH mysql_native_password AS '%s'",
$link->escape_string($data['new']['database_user']),
$db_host,
$link->escape_string($data['new']['database_password']));
$link->query($query);
}
$app->log('Changing MySQL user password for: ' . $data['new']['database_user'] . '@' . $db_host, LOGLEVEL_DEBUG);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment