1,查看root远程登录访问
mysql> select host,user from user where user='root';
+-----------+------+
| host | user |
+-----------+------+
| % | root |
| 127.0.0.1 | root |
| localhost | root |
+-----------+------+
3 rows in set (0.00 sec)
2,设置root远程访问
mysql> grant all privileges on *.* to 'root'@'192.168.1.%' identified by 'root123456' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
3,刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
4,查看
mysql> select host,user from user where user='root';
+-------------+------+
| host | user |
+-------------+------+
| 127.0.0.1 | root |
| 192.168.1.% | root |
| localhost | root |
+-------------+------+
3 rows in set (0.00 sec)