The solution to the problem that mysql cannot be accessed from the external network: First enter the mysql database and query the user; then execute [update user set host='%' where user ='root';] and execute refresh privileges [flush privileges] .
The operating environment of this tutorial: Windows 7 system, mysql version 8.0.22, DELL G3 computer.
Solution to the problem that mysql cannot be accessed from the external network:
Perhaps sometimes you will access the database of the project through the IP address, but the access fails.
Now I give you a solution:
#进入mysql数据库 USE mysql;
#查询用户 SELECT HOST,USER,PASSWORD FROM USER;
You can see that if user is root and host is localhost,
It means that mysql only allows local connections, then the external network , the local software client cannot connect.
#调整方法: #执行: update user set host='%' where user ='root';
#执行刷新权限: flush privileges;
You can test the external network connection to the mysql server.
Related free learning recommendations: mysql video tutorial
The above is the detailed content of What should I do if mysql cannot be accessed from the external network?. For more information, please follow other related articles on the PHP Chinese website!