Forum Moderators: coopster

Message Too Old, No Replies

Error connecting to mysql server

         

phex

12:46 pm on Jul 25, 2019 (gmt 0)

10+ Year Member



I recently installed wampserver 3.1.9. I keep on getting an error message :
Warning: mysqli_comnect (): (HY000/2000): no connection could be made because the target machine actively refused it.
Help please

Dimitri

3:07 pm on Jul 25, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Check that the parameters, you use in PHP, to connect your MySQL server, are matching your MySQL configuration.

Is your PHP script running on the same machine as your MySQL server? or is it a remote access?

phex

5:18 pm on Jul 25, 2019 (gmt 0)

10+ Year Member



It is on same machine. Could you elaborate more please.

Apache is running on port 8080 and mysql on 3308

Dimitri

1:43 pm on Jul 26, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Your MySQL server is configured to listen a given port, your database (must) be configured to require a user name and password. So, verify that in your PHP script, you are using the right ip/port/user/password. You might need to use localhost or 127.0.0.1 or a socket file , by default, I think that MySQL is not answering remote access using the IP of the server, for example. I am unsure how this is exactly under Windows.

gxbc

1:22 pm on Aug 4, 2019 (gmt 0)

5+ Year Member



If you are running MySQL in the same server as HTTP, then you should use "localhost" as server hostname.

If you are using a remote (External) server, then you must enable this remote connection in your MySQL config.

Dimitri

1:21 pm on Aug 5, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



f you are using a remote (External) server, then you must enable this remote connection in your MySQL config.

And open the port in the firewall too... everybody use a firewall, and leave only the very strict minimum opened, isn't it ?