Welcome to WebmasterWorld Guest from 18.207.134.98

Forum Moderators: coopster & jatar k

Error connecting to mysql server

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

Junior Member from ZA 

10+ Year Member

joined:Sept 19, 2008
posts: 53
votes: 0


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
3:07 pm on July 25, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1194
votes: 285


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?
5:18 pm on July 25, 2019 (gmt 0)

Junior Member from ZA 

10+ Year Member

joined:Sept 19, 2008
posts: 53
votes: 0


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

Apache is running on port 8080 and mysql on 3308
1:43 pm on July 26, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1194
votes: 285


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.
1:22 pm on Aug 4, 2019 (gmt 0)

New User

joined:Aug 4, 2019
posts:3
votes: 0


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.
1:21 pm on Aug 5, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1194
votes: 285


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 ?