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

@ -1,14 +1,4 @@
use test;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v2;
DROP VIEW IF EXISTS v3;
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP FUNCTION IF EXISTS f3;
CREATE TABLE t1(c INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
FOR EACH ROW
@ -95,3 +85,29 @@ Acl_role_grants 0
Acl_roles 0
Acl_table_grants 0
Acl_users 0
show create user root@localhost;
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
insert mysql.global_priv values ('foo', 'bar', '{}');
insert mysql.global_priv values ('baz', 'baz', '{"plugin":"baz"}');
set password for bar@foo = password("pass word");
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
flush privileges;
show create user root@localhost;
CREATE USER for root@localhost
CREATE USER 'root'@'localhost'
show create user bar@foo;
CREATE USER for bar@foo
CREATE USER 'bar'@'foo'
show create user baz@baz;
CREATE USER for baz@baz
CREATE USER 'baz'@'baz' IDENTIFIED VIA baz
set password for bar@foo = password("pass word");
show create user bar@foo;
CREATE USER for bar@foo
CREATE USER 'bar'@'foo' IDENTIFIED BY PASSWORD '*EDBBEA7F4E7B5D8B0BC8D7AC5D1936FB7DA10611'
alter user baz@baz identified with mysql_native_password as password("baz");
show create user baz@baz;
CREATE USER for baz@baz
CREATE USER 'baz'@'baz' IDENTIFIED BY PASSWORD '*E52096EF8EB0240275A7FE9E069101C33F98CF07'
drop user bar@foo;
drop user baz@baz;