Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that MySQL cannot connect from the outside?

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to solve the problem that MySQL cannot be connected from the outside". In daily operation, I believe many people have doubts about how to solve the problem that MySQL cannot be connected from the outside. Xiaobian consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the question of "how to solve the problem that MySQL cannot be connected from the outside"! Next, please follow the small series to learn together!

MySQl is installed locally by default, meaning if your website and database are on the same server, it is accessible. But if your site and database are not on separate servers, your site will not be able to use the remote database (the database server refuses access). Solution:

Method 1:

Log in to phpmyadmin, change the "host" entry in the "user" table in the "mysql" database from "localhost" to "%", and restart the server.

Method 2 (authorization method):

For example, to allow myuser to connect to mysql servers from any host using password 1234, type:

GRANT ALL PRIVILEGES ON.TO'myuser' '%'IDENTIFIED BY'1234'WITH GRANT OPTION;

Here % means all IP addresses are allowed access. It can be changed to a specific IP, such as:

To allow the account myuser to connect to mysql servers from a host with ip 192.168.1.3 and use 12345 as the password, type:

GRANT ALL PRIVILEGES ON.TO'myuser' '192.168.1.3'IDENTIFIED BY'12345'WITH GRANT OPTION;

Finally, let the settings take effect

mysql>FLUSH PRIVILEGES;

At this point, the study on "how to solve MySQL can not be connected from the outside" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report