mysql_secure_installation doesn’t seem to work on the newest Debain

After some googling I think I found what works for me.

Delete anon user

DELETE FROM mysql.user WHERE User='';

delete non local root user

DELETE FROM mysql.user WHERE User=‘root’ AND Host NOT IN (‘localhost’, ‘127.0.0.1’, ‘::1’);

drop test database

DROP DATABASE IF EXISTS test;

drop all other root users

drop user ‘root’@‘localhost’;

drop user ‘root’@‘127.0.0.1’;

drop user ‘root’@'::1';

create a new root user with password

CREATE USER ‘root’@'%' IDENTIFIED BY ‘password’;

make user super user

GRANT ALL PRIVILEGES ON . TO ‘root’@'%' WITH GRANT OPTION;

as always flush stuff

FLUSH PRIVILEGES;