mysql映射外网访问不了的解决方法:
1,修改表,登录mysql数据库,切换到mysql数据库,使用sql语句查看"select host,user from user ;"在命令行输入如下:
mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user ='root';
mysql>select host, user from user;
mysql>flush privileges;
2.授权用户。命令如:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'admin123' WITH GRANT OPTION;flush privileges;
例如:允许用户root从ip为192.168.1.104的主机连接到mysql服务器的代码:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.104' IDENTIFIED BY 'admin123' WITH GRANT OPTION;flush privileges;