Pages: 12Next
Current Page: 1 of 2
PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: codeslayer2010 (---.se.biz.rr.com)
Date: April 08, 2021 05:47PM

NOTE: I was unable to find clear instructions in English on how to ensure this is posted on the WampServer English forum. Something appears to have changed about the forum interface.

---


I'm using **WAMPServer 3.1.7** on Windows 10 Home 64-Bit. It has been running fine on my system for 4 years. All of a sudden, about a month ago, PhpMyAdmin stopped working.

- WAMPServer is running and I can access localhost start page
- Taskbar icon is GREEN
- I can login and interact with MySQL via CLI (Command line)

## ERROR:

I can't login to PhpMyAdmin, but the error doesn't seem to be related to passwords or username credentials. At the top is this error

>#2002 - No connection could be made because the target machine actively refused it. — The server is not responding (or the local server's socket is not correctly configured).

At the bottom is this error:

>mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.

Again, it is **IMPORTANT** to note that this _only started about a month ago_. Before that everything worked fine.


---

PS: I posted about this on Stack Overflow, but it looks like I've hit a dead-end on suggestions for a solution, so I'm trying this forum, since you guys should know more of the "weird bits".

Any help is appreciated.

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]



Edited 2 time(s). Last edit at 04/08/2021 05:51PM by codeslayer2010.

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: Otomatic (Moderator)
Date: April 08, 2021 06:48PM

Hi,

Please READ (and answer) BEFORE YOU ASK A QUESTION

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.8 32 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.8 64 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37/8.0.28 - MariaDB 10.5.13/10.6.5
PhPMyadmin 5.1.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: RiggsFolly (Moderator)
Date: April 10, 2021 08:48PM

Sorry but you are not telling us anything more than you did on the StackOverflow question.

I see you said you changed

Quote

$cfg['Servers'][$i]['port'] = 8111

That looks like the usual confusion people get between the litening port used by Apache and MySQL. So if you followed any other advice from that chap, undo it all.

It really soulds like you have got the MySQL ports messed up somehow. But you will have to provice more informations for us to help.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.5 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: codeslayer2010 (---.res.spectrum.com)
Date: April 14, 2021 03:45PM

>Please READ (and answer) BEFORE YOU ASK A QUESTION

@Otomatic, thanks for the link. I have read that post before in 2016 (or one with a similar purpose), but it looks like you have changed some things since then. I did read that post after your reply and it looks like it will take me some time to provide a complete set of data for you. I will try to get that done by this weekend.



Edited 1 time(s). Last edit at 04/14/2021 03:47PM by codeslayer2010.

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: codeslayer2010 (---.res.spectrum.com)
Date: April 14, 2021 03:58PM

RiggsFolly Wrote:
-------------------------------------------------------
> Sorry but you are not telling us anything more
> than you did on the StackOverflow question.
> ...
> It really soulds like you have got the MySQL ports
> messed up somehow. But you will have to provice
> more informations for us to help.

Thanks for your reply @RiggsFolly. I updated the Stack Overflow post you referenced with 4 config/ini files + 1 diagnostic output screen over a week ago. I am already working on gathering and assembling the requirements requested by Otomatic. Please let me know what other files or outputs would be helpful and I will be happy to provide them.

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: RiggsFolly (Moderator)
Date: April 14, 2021 09:44PM

It looks more and more like this is a Firewall blocking port 3307/8 which makes it look like the MySQL server is not started

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.5 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.247-40.dynamic.3bb.co.th)
Date: April 15, 2021 10:41AM

hello OP,

I had a similar issue some months back, it appears that during updates, Windows removes some necessary VC++ redistribuable files from your system without telling or asking you about it.

run this to check for necessary VC++ files:

[wampserver.aviatechno.net]

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.247-40.dynamic.3bb.in.th)
Date: April 15, 2021 11:43AM

and actually,I had the same problem, but the VC++ checker says all files are installed.

and in the windows event viewer, I got this error:

Can't start server: Bind on TCP/IP port. Got error: 10013: An attempt was made to access a socket in a way forbidden by its access permissions.

I was also unable to start the MariaDB service from services.msc
(service is named wampmariadb46)

luckily I found this page:
[www.drivereasy.com]

I followed the steps.

After the MERGE, I needed to restart one more time before wampmariadb64 appeared in the list of services.

tried restarting... et voilà, green icon for wampserver !!!

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.220-71.dynamic.3bb.co.th)
Date: April 18, 2021 08:03AM

so, actually one day later, I am back to the same problem:

wampmariadb64 refuses to start

I run the check_vcredist utility, and BAM! the 2 2015-2019 VC redists are missing. This still worked fine yesterday.

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.220-71.dynamic.3bb.co.th)
Date: April 18, 2021 08:14AM

so now after the restart, wampmariadb64 still refuses to start, although I have installed all VC++ redists

I'll try again following the steps here:
[www.drivereasy.com]

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.216-227.dynamic.3bb.co.th)
Date: April 19, 2021 10:38AM

and it worked yesterday, and today wampserver and wampmaria started with no issues...

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.216-227.dynamic.3bb.in.th)
Date: April 21, 2021 05:51AM

and today it again doesn't work ...

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.216-227.dynamic.3bb.in.th)
Date: April 21, 2021 06:11AM

getting closer:


I try to reserve port 3306 doing
"netsh int ipv4 add excludedportrange protocol=tcp startport=3001 numberofports=1"

reply: "The process cannot access the file because it is being used by another process"

then I try:
"netstat -ano | findstr 3306"

reply: nothing.

???

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.216-227.dynamic.3bb.in.th)
Date: April 21, 2021 06:30AM

finally, the answer is here.

Microsoft Hyper-V is reserving ports, but not using them.

here we can see the reserved port ranges:
netsh int ip show excludedportrange protocol=tcp

on my system, 3306 was within an excluded range.

Microsoft has f'cked up again by making commonly used ports available for Hyper-V.

to correct his, follow the steps described here:
[stackoverflow.com]

and reserve port 3306 for mysql/mariadb

finally solved !

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: RiggsFolly (Moderator)
Date: April 21, 2021 05:08PM

I get



>netsh int ip show excludedportrange protocol=tcp

Start Port    End Port
----------    --------
      5357        5357
     49564       49663
     49699       49798
     49799       49898
     50000       50059     *
     59408       59507
     59508       59607
     59608       59707
     59912       60011
     60012       60111
     60112       60211
     62941       63040
     63041       63140
     63141       63240

* - Administered port exclusions.

where no reported ports are anywhere near the one's used by any of the WAMPServer servers.


It might be useful to know why this is happening on your system and not others.

When I look at `services.msc` of all the Hyper-V services only `Hyper-V Virtual Machine Management` is set to Auto-Start, the rest are all set to MANUAL or MANUAL(Trigger Start)

What are yours set to?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.5 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 04/21/2021 09:24PM by RiggsFolly.

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: manarak (---.204.216-227.dynamic.3bb.in.th)
Date: April 21, 2021 07:31PM

the ports chosen by Hyper-V are random and change when the computer is restarted, which explains why it was working on some days and others not.

also, I have a virtual machine installed on my computer, which possibly causes hyper-V to run at every start, or at least it reserves ports at the start.



Edited 2 time(s). Last edit at 04/22/2021 10:33AM by manarak.

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: codeslayer2010 (---.res.spectrum.com)
Date: April 23, 2021 06:33PM

codeslayer2010 Wrote:
-------------------------------------------------------
> >Please READ (and answer) BEFORE YOU ASK A
> QUESTION
>
> @Otomatic, thanks for the link. I have read that
> post before in 2016 (or one with a similar
> purpose), but it looks like you have changed some
> things since then. I did read that post after your
> reply and it looks like it will take me some time
> to provide a complete set of data for you. I will
> try to get that done by this weekend.

@Otomatic: Here are the answers to the questions in your link:

--- --- --- --- --- --- ---

NOTE: *Web servers and networking are my weakest areas as a seasoned web developer, so forgive me if I don't understand some concepts like netsh, sockets, ports, port forwarding, etc. right away.*

QUESTION: I can understand why questions 1-12 might help troubleshoot, but what do virtual hosts have to do with phpMyAdmin not connecting to MySQL? Aren't v-hosts basically just "aliases" (shortcuts)?

--- --- --- --- --- ---

** ANSWERS TO QUESTIONS **

When you ask a question, please ensure you start your question with the answers to **ALL these 13 questions**.

1 - Windows version used: **Windows Home 64-Bit (Build: 19042)**
2 - Version WampServer: **3.2.5 64-bit**
3 - Apache Version: **2.4.23**
4 - PHP Version: **7.0.10**
5 - MySQL Version: **5.7.14**
5a - MariaDB version if applicable: **N/A**
6 - What color is the WampServer icon: **GREEN**

7 - (If icon is NOT green): **N/A**

**If the WampServer icon is green:**

8 - Do you have access to localhost: **Yes**
8a - If so, is there an error message at the bottom of the page? **No, just a link to Wampserver Forums**

9 - Do you have access to phpMyAdmin? **No. The page comes up, but I get the two errors I mentioned already when I try to login** (standard user: root with NO PASSWORD)

- For good measure and completeness here are the error messages again:

--- --- ---
I can't login to PhpMyAdmin, but the error doesn't seem to be related to passwords or username credentials. At the top is this error

>#2002 - No connection could be made because the target machine actively refused it. — The server is not responding (or the local server's socket is not correctly configured).

At the bottom is this error:

>mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.

Again, it is **IMPORTANT** to note that this _only started about a month ago_. Before that everything worked fine.
--- --- ---

10 - If you refer to an error message, please include the EXACT wording of the error in your post: **Already provided.**

11 - If you use an Antivirus and / or Firewall: **Standard Windows Security included with Windows:**

- Domain network: Firewall On
- Private network (active): Firewall On
- Public network: Firewall On
- As far as I know, this is all default. I don't remember actively, manually changing any firewall settings.

12 - What is the full path to the installation of WampServer: **C:\wamp64\www**

13 - If you have one or more Virtual Hosts defined, please show their definition(s):

- *ServerName :* localhost - *Directory :* c:/wamp64/www
- *ServerName :* humescores.test - *Directory :* C:/wamp64/www/tuts/lyndalinkedin/wp
- *ServerName :* sealworks-20190328.ehw - *Directory :* c:/wamp64/www/in-progress/sealworks/20190328
- *ServerName :* nayarwp.local - *Directory :* c:/wamp64/www/tuts/nayyar-shaikh/1

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: codeslayer2010 (---.res.spectrum.com)
Date: April 23, 2021 06:37PM

RiggsFolly Wrote:
-------------------------------------------------------
> It looks more and more like this is a Firewall
> blocking port 3307/8 which makes it look like the
> MySQL server is not started

If that is the case, how should I go about testing and fixing it? And since I can login to MySQL command line client and access and perform queries on the databases fine, doesn't that mean that MySQL server HAS TO BE started? I'm still learning server concepts so be gentle with me please.

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: codeslayer2010 (---.res.spectrum.com)
Date: April 23, 2021 06:48PM

manarak Wrote:
-------------------------------------------------------
> hello OP,
>
> I had a similar issue some months back, it appears
> that during updates, Windows removes some
> necessary VC++ redistribuable files from your
> system without telling or asking you about it.
>
> run this to check for necessary VC++ files:
>
> [wampserver.aviatechno.net]
> _vcredist.exe


Thanks for the reply Manarak. I just ran the check_vcredist tool and here are the results:

2021-04-22, 11:30 AM

VC_2013_REDIST_X86_MIN ID={8122DAB1-ED4D-3676-BB0A-CA368196543E}
Visual C++ 2013 x86 Minimum Runtime - 12.0.40664
**** NOT INSTALLED ****
Installation file is on: [wampserver.aviatechno.net]
VC 2013 Package Up 5 (x86)
----------------------------------------
VC_2019_REDIST_X86 ID={1b5476d9-ab8e-4b0d-b004-059a1bd5568b}
Visual C++ 2015-2019 x86 - 14.28.29914
**** NOT INSTALLED ****
Installation file is on: [wampserver.aviatechno.net]
VC 2015-2019 (VC16 x86) 14.28.29914
----------------------------------------
VC_2013_REDIST_X64_MIN ID={53CF6934-A98D-3D84-9146-FC4EDF3D5641}
Visual C++ 2013 x64 Minimum Runtime Update 5 - 12.0.40664
**** NOT INSTALLED ****
Installation file is on: [wampserver.aviatechno.net]
VC 2013 Up 5 (x64)
----------------------------------------
VC_2019_REDIST_X64 ID={43d1ce82-6f55-4860-a938-20e5deb28b98}
Visual C++ 2015-2019 x64 - 14.28.29914
**** NOT INSTALLED ****
Installation file is on: [wampserver.aviatechno.net]
VC 2015-2019 (VC16 x64) 14.28.29914
----------------------------------------

How can that be? I had already ensured all the Visual C++ redistributables that were required were installed almost 3 or 4 years ago. Even after I switched from PHP 5 to PHP 7 this winter everything still worked.

Not sure where to go next. It used to be that you had to fully uninstall previous version of Wampserver before installing a new version. Now you can just update over top of the last version, but is that how it works with these VCRedistrs?

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]

Options: ReplyQuote
Re: PHPMyAdmin: No connection could be made because the target machine actively refused it
Posted by: Otomatic (Moderator)
Date: April 23, 2021 06:58PM

Hi,

> How can that be? I had already ensured all the Visual C++ redistributables that were required were
> installed almost 3 or 4 years ago.
The versions of Apache, PHP, MySQL and MariaDB evolve and these versions are compiled with the latest VC versions. That's why it's necessary to install the last versions of VC++ redistributables.

The verification tool must indicate : 'All VC++ packages needed to Wampserver are installed correctly'.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.8 32 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.8 64 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37/8.0.28 - MariaDB 10.5.13/10.6.5
PhPMyadmin 5.1.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.