use mysql;##然后查看下当前连接允许情况select host, user, authentication_string, plugin from user;##依次执行CREATE USER 'root'@'%' IDENTIFIED BY 'root';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';ALTER USER 'root'@'localhost' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;FLUSH PRIVILEGES;##再次查看连接情况select host, user, authentication_string, plugin from user;
完成;