Php connection to mysql error prompt: because the target computer is actively rejected, it is no problem to be unable to connect to mysql using a command prompt, including query insertion and update. Php. ini is configured as follows:; extensionphp_mysql.dll & nbsp; extensionphp_mysqli.dll & nbsp; the semicolon in front of php connects to mysql. error message: unable to connect because the target computer is actively rejected
There is no problem with using a command prompt to operate mysql, including querying, inserting, and updating data.
Php. ini configuration:; extension = php_mysql.dll
; Extension = php_mysqli.dll
The semicolon above is removed.
The error message is as follows:
Warning: mysql_connect () [function. mysql-connect]: [2002] Unable to connect due to the active rejection of the target computer. (Trying to connect via tcp: // localhost: 3306) in F: \ Apache \ htdocs \ ch13 \ 13-1.php on line 6
Warning: mysql_connect () [function. mysql-connect]: unable to connect because the target computer is actively rejected. In F: \ Apache \ htdocs \ ch13 \ 13-1.php on line 6
Database Connection failed:
Unable to connect because the target computer is actively rejected.
The php code is as follows:
PHP code
'. Mysql_error ();} echo' database connection successful! ';?>
------ Solution --------------------
Discussion
There is no problem with using a command prompt to operate mysql, including querying, inserting, and updating data.
Php. ini configuration:; extension = php_mysql.dll
; Extension = php_mysqli.dll
The semicolon above is removed.
The error message is as follows:
Warning: mysql_connect () [function. mysql-connect]: [2002] Unable to connect due to the active rejection of the target computer ......
------ Solution --------------------
I tried to shut down the firewall. in my personal experience, I thought it was a Firewall problem. it should be because Port 3306 was rejected.