1、查看初始密码

grep 'temporary password' /var/log/mysqld.log

2、设置密码

set password for root@localhost=password('root)');

3、授权及创建用户

grant all privileges on *.* to root@'%' identified by 'root';
create user sd identified by 'sd';

4、数据还原

gunzip < db_20210904.sql.gz | mysql -uroot -p db

5、取消权限

REVOKE delete, drop  ON *.* FROM 'sd'@'%';