An error occurred while connecting to mysql in php. the error code cannot be connected due to the rejection of the target computer:
PHP Warning: mysql_connect () [function. mysql-connect]: in E: \ website \ weixinpublic \ connectdb. php on line 6
PHP Warning: mysql_query () [function. mysql-query]: [2002] Unable to connect due to the active rejection of the target computer.
(Trying to connect via tcp: // localhost: 3306) in E: \ website \ weixinpublic \ connectdb. php on line 7
PHP Warning: mysql_query () [function. mysql-query]: unable to connect due to the active rejection of the target computer.
In E: \ website \ weixinpublic \ connectdb. php on line 7
PHP Warning: mysql_query () [function. mysql-query]: A link to the server cocould not be established in E: \ website \ weixinpublic \ connectdb. php on line 7
I forgot what operation caused this problem. I cannot connect to mysql using a webpage. Mysql is reinstalled or cannot be connected.
The firewall has been rectified and disabled.
The host file is also changed to 127.0.0.1 localhost for parsing.
Use root to connect. My. ini cannot be set to view the logs of warning.
There is no problem connecting locally with cmd. a mysql_native_password generated by tenlnet should also be connected ..
How can this problem be solved ??
Reply to discussion (solution)
Check the application log and find that there is such a line: Server hostname (bind-address): '0. 0.0.0 '; port: 3306
Will this binding affect? 0.0.0.0 is also the ip address of the local host.
MySQL service not started
MySQL service not started
Started. run the cmd command to access the database.
What is the MySQL version?
What is the MySQL version?
It's version 5.5. it can be connected with cmd and work. I used it all the time before. After I perform a specific operation, I cannot access it. I forgot the specific operation.
One problem is that even if I use the IP address of the server to connect to mysql on the server
For example: $ connection = mysql_connect ('59. 188.180.234: 8080', $ db_username, $ db_password );
What is still prompted on the php page?
PHP Warning: mysql_connect () [function. mysql-connect]: in E: \ website \ weixinpublic \ connectdb. php on line 6
PHP Warning: mysql_query () [function. mysql-query]: [2002] Unable to connect due to the active rejection of the target computer.
(Trying to connect via tcp: // localhost: 3306) in E: \ website \ weixinpublic \ connectdb. php on line 7
PHP Warning: mysql_query () [function. mysql-query]: unable to connect due to the active rejection of the target computer.
In E: \ website \ weixinpublic \ connectdb. php on line 7
PHP Warning: mysql_query () [function. mysql-query]: A link to the server cocould not be established in E: \ website \ weixinpublic \ connectdb. php on line 7
Q: How can I solve this problem?
Is your MySQL installed separately?
Is your MySQL installed separately?
It is installed separately. I guess it is my computer's php setting problem. This method is used. remote mysql cannot be connected. it can be connected in the past. If you use a domain name to connect to remote mysql, you will be prompted that the host cannot be found. But ping the domain name and ping...
Are you remotely connected?
So no authorization
Are you remotely connected?
So no authorization
It's not a remote connection, it's a local connection, because it cannot be connected locally, so I try to see if it can connect to a remote mysql, and then I find that the remote connection cannot be connected (the server rejects the connection), but the local connection cannot be connected, you can use cmd to connect to the server.
ThatRemote mysql cannot be connected.What does that mean?
Authorization is required for remote connection. this is a rule.
You run phpinfo () to paste the value of PATH to it.
ThatRemote mysql cannot be connected.What does that mean?
Authorization is required for remote connection. this is a rule.
You run phpinfo () to paste the value of PATH to it.
Now at the company and at home. Does the path item refer to the path configured by php. ini?
PATH is the environment variable of the operating system, used to notify the operating system where to find the software to be executed
PATH is the environment variable of the operating system, used to notify the operating system where to find the software to be executed
Well, this is also the path to the php executable file. how can this problem be solved after reading it?
No, it depends on whether the MySQL path is in it.
If yes, delete
What is the IP address bound to your mysql configuration file? try using localhost and 127.0.0.1 to check whether the IP address can be connected.
What is the IP address bound to your mysql configuration file? try using localhost and 127.0.0.1 to check whether the IP address can be connected.
Both addresses are used. bind_address is set for binding ip addresses to mysql. I didn't see this in my. ini. Should I have not set it?
The possible reason is that both cmd and mysql_workbench can be used for connection ..
For a local connection, replace the ip address with localhost or 127.0.0.1.
If the ip address is a remote ip address, you must enable the remote permission.
In Linux, check whether the port is open to the outside world. the firewall may be restricted. You can use the telnet ip segment to test whether the port is connected.
It is best to paste it under phpinfo (). It seems that you have changed the php configuration.
For a local connection, replace the ip address with localhost or 127.0.0.1.
If the ip address is a remote ip address, you must enable the remote permission.
After the change, the connection still fails ..