设置mysql的远程访问权限

打开cmd,进入到mysql的bin路径下

1、实现远程连接(授权法)

    mysql -u root -p(登陆mysql数据库)

 use mysql;

    grant all privileges  on *.* to root@'%' identified by "root";(后面这个root指的是mysql数据库的密码)

 exit即可。

2、实现远程连接(改表法)

   mysql -u root -p(登陆mysql数据库)

   use mysql;

   update user set host = '%' where user = 'root';

 exit即可。

猜你喜欢

转载自www.cnblogs.com/gwxppg/p/11388168.html