I have encountered the problem that MySQL can connect locally but cannot connect remotely before, but I didn’t record it. Today, I encountered this problem again on a newly applied server in the cloud. I will record the solution process. 1. Eliminate network or firewall issues First check whether you can ping the remote server, ping 192.168.1.211. If not, it is a network problem. Then, check if the port is blocked by the firewall, telnet 192.168.1.211 3306, if the connection fails, configure the firewall. vi /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT (allow port 3306 to pass through the firewall) /etc/init.d/iptables restart (restart the firewall to make the configuration take effect) 2. Check MySQL configuration If the firewall is enabled and telnet still fails, use netstat to check the status of port 3306: netstat -apn | grep 3306 tcp6 0 0 127.0.0.1:3306 :::* LISTEN 13524/mysqld Note that this indicates that 3306 is bound to the local computer. Check the configuration of my.cnf, where you can configure the binding IP address. 3. Check user access rights When creating a user in MySQL, a host will be specified. The default is 127.0.0.1/localhost. Then this user can only access the local machine. Other machines will be prompted that they do not have permission to access with this user account. Changing the host to % means that all machines are allowed to access. Finally, don't forget to restart MySQL for the configuration to take effect. # /etc/init.d/mysql restart The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Uniapp WeChat applet: Solution to key failure
>>: Implementing custom scroll bar with native js
Preface Before we start explaining the principle ...
Preface In the development of small programs, we ...
In some scenarios, we want to assign multiple IPs...
Copy code The code is as follows: <!DOCTYPE HT...
Copy code The code is as follows: <iframe id=&...
background: Since the company's projects seem...
This article describes how to implement coexisten...
Table of contents Concurrent scenarios Write-Writ...
Today I'd like to introduce a countdown made ...
1. The first method is to use the unhup command d...
Refer to the official documentation here for oper...
1) Introduction to cache mechanism In the Linux s...
Install boost There are many ways to call C/C++ f...
CSS is the realm of style, layout, and presentati...
1. mysql export file: SELECT `pe2e_user_to_compan...