Home  >  Article  >  Database  >  What should I do if mysql cannot be accessed from the external network?

What should I do if mysql cannot be accessed from the external network?

coldplay.xixi
coldplay.xixiOriginal
2021-03-03 11:24:395522browse

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] .

What should I do if mysql cannot be accessed from the external network?

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.

What should I do if mysql cannot be accessed from the external network?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn