User manager: Select "authentication_string" instead of "password" column on MySQL 5.7.6+. See http://www.heidisql.com/forum.php?t=18650

This commit is contained in:
Ansgar Becker
2015-06-28 10:25:29 +00:00
parent ef9dffd055
commit d02f9822b3

View File

@@ -243,7 +243,7 @@ var
Version: Integer;
Users: TDBQuery;
U: TUser;
tmp: String;
tmp, PasswordCol: String;
SkipNameResolve: Boolean;
function InitPrivList(Values: String): TStringList;
@@ -261,6 +261,7 @@ begin
PrivsTable := InitPrivList('ALTER,CREATE,DELETE,DROP,GRANT,INDEX');
PrivsRoutine := InitPrivList('GRANT');
PrivsColumn := InitPrivList('INSERT,SELECT,UPDATE,REFERENCES');
PasswordCol := 'password';
if Version >= 40002 then begin
PrivsGlobal.Add('REPLICATION CLIENT');
@@ -293,6 +294,10 @@ begin
PrivsDb.Add('PROXY');
end;
}
if Version >= 50706 then begin
PasswordCol := 'authentication_string';
end;
PrivsTable.AddStrings(PrivsColumn);
PrivsDb.AddStrings(PrivsTable);
@@ -317,7 +322,7 @@ begin
SkipNameResolve := LowerCase(tmp) = 'on';
FConnection.Query('FLUSH PRIVILEGES');
Users := FConnection.GetResults(
'SELECT '+FConnection.QuoteIdent('user')+', '+FConnection.QuoteIdent('host')+', '+FConnection.QuoteIdent('password')+' '+
'SELECT '+FConnection.QuoteIdent('user')+', '+FConnection.QuoteIdent('host')+', '+FConnection.QuoteIdent(PasswordCol)+' '+
'FROM '+FConnection.QuoteIdent('mysql')+'.'+FConnection.QuoteIdent('user')
);
FUsers := TUserList.Create(True);
@@ -325,7 +330,7 @@ begin
U := TUser.Create;
U.Username := Users.Col('user');
U.Host := Users.Col('host');
U.Password := Users.Col('password');
U.Password := Users.Col(PasswordCol);
U.Problem := upNone;
if Length(U.Password) = 0 then
U.Problem := upEmptyPassword;