首页 > 代码库 > mysql增加远程访问权限

mysql增加远程访问权限

mysql> use mysql;

Database changed


mysql> select host,user from user where user="root";

+-----------+------+

| host      | user |

+-----------+------+

| 127.0.0.1 | root |

| ::1       | root |

| localhost | root |

+-----------+------+

3 rows in set (0.02 sec)


mysql> Grant all on *.* to ‘root‘@‘10.3.0.4‘ identified by ‘root‘ with grant o

ption;Query OK, 0 rows affected (0.09 sec)

吧10.3.0.4替换成% 是所有IP允许登录

mysql> select host,user from user where user="root";

+-----------+------+

| host      | user |

+-----------+------+

| 10.3.0.4  | root |

| 127.0.0.1 | root |

| ::1       | root |

| localhost | root |

+-----------+------+

4 rows in set (0.00 sec)


mysql增加远程访问权限