参考博客1
参考博客2
以为下面四个用户没用,然后删了,结果出现了不可挽回的局面
- 首先打开cmd命令行,执行net stop mysql,把mysql服务先关掉:
- 输入命令mysqld --console --skip-grant-tables --shared-memory
- 另开个管理员cmd窗口,输入mysql
- 创建用户并授权
use mysql;
create user 'root'@'localhost' identified by '123456';
create user 'mysql.infoschema'@'localhost' identified by '123456';
create user 'mysql.session'@'localhost' identified by '123456';
create user 'mysql.sys'@'localhost' identified by '123456';
FLUSH PRIVILEGES;
grant all privileges on *.* to 'root'@'localhost';
grant all privileges on *.* to 'mysql.infoschema'@localhost identified by '123456';
grant grant option on *.* to 'mysql.infoschema'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'mysql.infoschema'@'localhost';
FLUSH PRIVILEGES;
希望能给大家一些帮助,共勉