实现远程连接(授权法)
将host字段的值改为%就表示在任何客户端机器上能以root用户登录到mysql服务器,建议在开发时设为%。
update user set host = ’%’ where user = ’root’;
将权限改为ALL PRIVILEGES
shell> mysql -uroot -p$MYSQL_ROOT_PASSWORD; mysql> grant all privileges on *.* to root@'%' identified by "root"; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
这样机器就可以以用户名root密码root远程访问该机器上的MySql.