1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-18297 How to reset a forgotten root password

After FLUSH PRIVILEGES remember if the connection started under
--skip-grant-tables and keep it all-powerful, not a lowly anonymous.

One could use this connection to reset passwords as needed.

Also fix a crash in SHOW CREATE USER
This commit is contained in:
Sergei Golubchik
2019-02-19 12:58:11 +01:00
parent a94b20a8e0
commit 4386d93500
5 changed files with 62 additions and 40 deletions

View File

@ -2557,6 +2557,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
init_check_host();
thd->bootstrap= !initialized; // keep FLUSH PRIVILEGES connection special
initialized=1;
DBUG_RETURN(FALSE);
}
@ -8908,6 +8909,11 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
uint head_length;
DBUG_ENTER("mysql_show_create_user");
if (!initialized)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(TRUE);
}
if (check_show_access(thd, lex_user, &username, &hostname, NULL))
DBUG_RETURN(TRUE);