# 进入MySQL登录 [root@master local]# mysql -u root -p # 使用上述的临时密码进行登录 Enter password: rldW%6_5J3h< Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.16 MySQL Community Server - GPL # 通过命令修改登录密码 mysql> alter user 'root'@'localhost' identified with mysql_native_password by '所要修改的密码需包含大小写字母、数字及特殊符号';
默认密码检查策略要求必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位,否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements。
6. 远程访问授权
1 2 3 4 5 6 7 8 9
# 创建远程访问用户 mysql> create user 'root'@'%' identified with mysql_native_password by '远程访问密码'; Query OK, 0 rows affected (0.01 sec) # 允许访问权限 mysql> grant all privileges on *.* to 'root'@'%' with grant option; Query OK, 0 rows affected (0.01 sec) # 刷新权限列表 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)