Php connection to mysql exception prompt: unable to connect because the target computer is actively rejected

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.