初次安装MySQL5.7后,是不能远程登录的,需执行以下指令:
mysql> grant all privileges on *.* to 'root'@'%'with grant option;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
为什么会出现这种错误,是因为5.7有个password_validation插件,将其卸载即可,操作指令如下:
mysql> uninstall plugin validate_password;
重新执行grant指令:
mysql> grant all privileges on *.* to 'root'@'%'with grant option;
ERROR 1133 (42000): Can't find any matching row in the user table
解决该错误:
mysql> grant all privileges on *.* to 'root'@'%'identified by '123456' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
注意:在执行grant指令之前,需要指定database:mysql,即执行上述grant指令前,需执行use mysql指令。