PHP links to a remote server on Alibaba cloud. It uses native tests and simple code.
First:
1. MySQL related extensions have been installed
2. the MySQL server on the remote server has allowed remote access, and the local connection test has been successful through phpstrom, native premium and other tools.
But now there is a problem. When I was in mysqli_ When the first parameter of contentn() is filled in the remote address, the IP address of the final error message is actually my Internet address.
As shown in the following figure:
183.156.*.*: This is my Internet address.
139.224.*.*: This is the remote MySQL address I want to access
Now the puzzle is, please give me some advice!
,Look at the following results
use mysql;
select Host,User,Password from user;
,@The latter originally refers to the IP address of the client. Check whether the user name, password and database name are correct,Alibaba cloud databases are not accessible from the Internet,To be clear, your phpstorm and Navicat use this 183.156 x. X IP connected database? If so, I don’t know how to solve it. If not, I think you should know how to solve it.,As the above partner replied to you:
The address in the error report should be your Internet IP. It represents the connection source IP, not the server IP.
As for why you can’t connect to the PHP script database, I really feel that you may be dazzled. Is there a wrong user name, password and database. Fill the data in the code into the tool and try again?
Anyway, it feels a little weird!!!,I seem to know the problem. I just read the MySQL [email protected] Xuankong alien
Embarrassed, as if Aite couldn’t help others)
The passwords in the first and third lines are always set locally.
The password in the second line is the password set in my online code.
In other words, MySQL will be based on different sources, but the users are the same and the passwords are different..
In the end, I still rely on the reminder of @ Xuankong alien to check the password.. And find the problem
Look at the following results
use mysql;
select Host,User,Password from user;
The author said that phpstorm and navicate can be connected. This reason may not exist.
Thanks for reminding me. I was careless.
You’re welcome. You’ve at least provided a solution.
Thank you for your answer. 1) I have opened all ports for testing.
This, as shown in Figure 1, is the statement of this result. On the left is my 135.224.Also remote data.. This is linked using navicate.
@Shwy password field is not empty
Of course, it’s not empty. Because the online code is accessible. Just changed the address to 127.0.0.1 The user name and password are consistent
@If shwy can, try resetting the root password. There’s no other way.
Reset.. Still the same, unable to access, egg’s sadness
@Shwy service MySQL restart or flush privileges?
That’s for sure. My server has been restarted directly.. I’m looking. Thank you
3q, I know the solution to the problem. Look at the last one I sent
@The latter originally refers to the IP address of the client. Check whether the user name, password and database name are correct
User name and password. The name can be guaranteed to be correct. Because I copied it directly from the online code. The difference between online and offline is that the address is different
I used Alibaba cloud to test it myself. There is no problem. Since local tools can be connected, PHP can certainly be connected
Yes, but look at my doubts. My mysqli_ Content (), the address is the IP address of my remote server. Then, the wrong IP address is indeed the IP address of our external network..
The address in the error report should be your Internet IP. It represents the connection source IP, not the server IP
Read the error message carefully: mysqli_ Connect(): (hy000/1045): access denied for user’root’@’183.156.‘ (using password: YES)What this means is that I am putting 183.156.The server of this one. Instead of 135. And 135 is the remote server address I want to access
Alas, if you use the client, change the password to see what the error information is
I just tried. First, I changed the online code directly, and the password became the wrong password. Then access directly through the online domain name. The error is mysqli_ Connect(): (hy000/1045): access denied for user’root’@’localhost'(using password: yes). Ps: the server address of my online configuration is 127.0.0.1 Therefore, this is localhost. So, the IP you said was the source IP. I don’t think so
Alibaba cloud databases are not accessible from the Internet
Why can I successfully link with data tools such as native premium? Figure 1 shows the link after it is successfully linked.Moreover, I have opened all the agreements.. But it seems that there is no way to send pictures in the commentsAllow all-1/-1 address segment access0.0.0.0/0-110 2017-05-04 15:38:14
To be clear, your phpstorm and Navicat use this 183.156 x. X IP connected database? If so, I don’t know how to solve it. If not, I think you should know how to solve it.
The successful link between phpstorm and Navicat is 139.224.Database for. 183.156 x. X this is the IP address of our company’s external network. There is no database.. So, my doubts are actually here..
As the above partner replied to you:
The address in the error report should be your Internet IP. It represents the connection source IP, not the server IP.
As for why you can’t connect to the PHP script database, I really feel that you may be dazzled. Is there a wrong user name, password and database. Fill the data in the code into the tool and try again?
Anyway, it feels a little weird!!!
Look at the last answer. I already know the question.. Sensory response
I seem to know the problem. I just read the MySQL [email protected] Xuankong alien
Embarrassed, as if Aite couldn’t help others)
The passwords in the first and third lines are always set locally.
The password in the second line is the password set in my online code.
In other words, MySQL will be based on different sources, but the users are the same and the passwords are different..
In the end, I still rely on the reminder of @ Xuankong alien to check the password.. And find the problem
Yes, even if the user name and password are the same, different or empty passwords correspond to different connection methods. I have experienced this pit for many times.
This is my first time to encounter this pit. Thank you for your help
What’s more, all my passwords have been changed, and I can still log in with root..
See