因为root只能本地访问:
mysql> use mysql;
Database changed
mysql> CREATE USER 'test'@'%' IDENTIFIED BY 'Hello@123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'test'@'%' IDENTIFIED BY 'Hello@123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
修改密码:
mysql> set password for 'root'@'%' = PASSWORD('newpassword');