-1

I got a error message saying "No connection":

Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\xampp\memberSystemBasic\memberSystemBasic\connect_to_mysql.php on line 18`

No connection could be made because the target machine actively refused it.

Please help me on this one. Thank you.

Community
  • 1
  • 1
  • is the mysql server running ? did you set host,username,password etc. values for the mysql server correctly ? – Himal Apr 30 '14 at 06:05
  • 1
    Only hostname/port is relevant. If the user data incorrect, he would get a different message. – Adrian Preuss Apr 30 '14 at 06:08
  • 3
    [Why shouldn't I use mysql_* functions in PHP?](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – Phil Apr 30 '14 at 06:10
  • I wold request you to go through these links solution https://www.google.co.in/#q=no+connection+could+be+made+because+the+target+machine+actively+refused+it.+php – Vishwanath Dalvi Apr 30 '14 at 06:11

1 Answers1

2

If the Database-Server refuse the connection, the Database-Server is not listen to the public (and you try to connect external). Use localhost or 127.0.0.1 for local connections. Otherwise your Database-Server is not started - Go to your XAMPP Control Panel and start the MySQL Server!

To enable external Database-Access, comment out the line bind-address = 127.0.0.1 in my.cnf

If you don't have access to the server configuration, contact your server administrator.

Information:

mysql_* has marked as DEPRECATED, please use PDO or MySQLi

Brandon White
  • 997
  • 9
  • 22
Adrian Preuss
  • 3,228
  • 1
  • 23
  • 43