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


I’ve already had my Virtual hosts set up. No problem. It’s an easy thing to do. No big deal. My only glitch in setting up the newer version of Apache is I forgot to uncomment the module that enables virtual hosts, so for a time I was tearing my hair out trying to figure out what was wrong! LOL I felt stupid when I found the problem staring me in the face, as I went over the httpd.conf file for the umteenth time!


Yes. Which is what I said in the last comment that you need to figure out what is using the port that MySQL is supposed to use. Uninstall MySQL and reinstall it with a different port and it should work.


Don’t think so, dude.Others who have had problems have been told to make sure they are using port 3306, which is the default port, and by the way, how could I connect using command prompt if the port # was the problem?


It would be nice to see screenshots of your command prompt and what you’ve installed including the services window to clarify what’s going on. Without this, all you’re really going to get is guesstimations on what may be causing the problem. It has been repeated numerous times in this thread to show what you have so we can determine what’s going on.


“Repeated numerous times?”



What about the services window? In your original post, you said you don’t have Skype installed, but Skype for business is preinstalled on Windows 10 I believe. This usually takes the port MySQL uses. The reason why I keep asking you to show the services window is because it shows you what services are running and what port those services are using.


I was trying to get that. For some reason, I couldn’t get it to copy. I’ll try again.I think I uninstalled Skype when I set up. Windows 10 is loaded with a lot of junk apps. I still haven’t gotten rid of them all.I don’t know why they loaded all that crap. I would rather have had a word processing program. I was able to install my old Word 2000.


For some reason, it won’t make a screen shot of Task Manager. Go figure.


I’ll try to replicate this problem when I get home in 3 or so hours. I have a hunch though what is causing the problem. Since this error is very generic, it actually has tons of things that can cause this problem. For instance, what I was trying to tell you in my earlier post about the bad data being sent. There’s a folder called Data that’s hidden in the Program Data folder at the root of the C: drive and that’s where all MySQL data is stored. Sometimes, if broken or incomplete data is sent to it, the SQL server may refuse connection. Other examples is firewall issue.

My hunch is telling me that since this is pointing at PHPMyAdmin, that might be where the solution lies. Did you create a file? If so, what did you put in it? This should be in your PHPMyAdmin folder.


I created the file at installation:

<?php $cfg['blowfish_secret'] = 'hpvsrv7192xyzhorgkins6144mpdsvrh2549981wabcxvs'; $cfg['Servers'] [1] ['auth_type'] = 'cookie'; ?>

This is the basic file. Same as the one I had when installed on Windows XP, which is per Keven Yank’s book (Sitepoint). I tried some different options, but no change.

Here’s another wrinkle. Today I’m getting this:
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers

mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers

But I’m not getting the other message (HY2002) …about connection being refused. Not sure why the change.

I’ve been in the C:/Program Data folder based on a suggestion from a Youtube video that purported to have the solution to the problem, but the ‘solution’ didn’t work, and only broke the server. I had to re-install it to get it working again.


From Program Data:


What version of PHPMyAdmin do you have installed? Also, remember that if you install a newer version of PHPMyAdmin, you should really use the new file. That’s why things break when you try to do backwards compatibility with older codes or configurations. You have to understand that things have changed from the time you’ve been using PHP on Windows XP compared to Windows 10. You can’t just keep comparing and trying to make things the way you remember it from Windows XP. It won’t work like that.

What did you touch? Was it the my.ini file? If you did, revert what you did. Stop touching things until you can figure out what’s wrong with the first problem. If you keep touching things before you read up on what might happen, it’s going to just break what you have working.


phpMyAdmin 4.8.3, which is the current version, and stated to be compatible with PHP 5.5 to 7.2, and MySQL 5.5 and newer. So, there should be no incompatibility problem. I used the “new” (and it isn’t really new), and inserted the basic code (as I noted earlier), which for my purposes should work and I shouldn’t need anything else. I have read through the documentation,, and didn’t fine anything there that would be relevant to the issue. I did try other log-in options, but they aren’t really something that would have triggered the connection problem either. You can read for yourself.

I know things have changed, which is why I updated to Apache 2.4, PHP 5.6, MySQL 8.0, and phpMyAdmin 4.8. I’m not exactly a “newbie” here. I’m the in-house “geek” here at our house, keeping our computers (3) up and running and troubleshooting when necessary. I’m currently repairing a motherboard for my old XP machine, which coincidentally broke out just after I got my new computer, and wouldn’t start. I still need some things off the hard drive. Yes, it’s the motherboard. I tested the power supply and other possible causes. Then, inspecting the motherboard, I found 7 bad electrolytics (evidenced by crowned top;i.e., leaking). This is likely the reason the computer wouldn’t start (similar problem in a dead monitor which I repaired several months ago …always suspect bad caps with such problems). But I digress.

While things have change since XP, a lot of things have stayed the same. Files are the same; "Windows/system32/drivers//etc/hosts, for example, Progam Files (Windows 10 added “Program Files (x85)”). Also, Enviroment Variables …not that much has changed, really. Mostly what has changed are things likd Start Menu and user interface files and tools. That’s what takes getting used to.

As to your final comment, I didn’t “touch anything.”

P.S.: As of this morning, it’s back to the original problem, though I have “touched” nothing.


I’d still stick to using the file and just replacing what I need. Basic files typically can break things if something is missing.

Wasn’t implying it. I just said that things have changed and it makes no sense to bring up the past if there are new ways of doing it.

The error was referring to a misconfiguration in my.ini. It didn’t happen until I mentioned about the Data folder inside of Program Data. So I’m not accusing you of anything, but it would be a nice thing to fix your original problem first before you do anything with any other files. What I mention to you is only trying to eliminate the possibilities of problems.


Is this what you have for your controluser?

$cfg['Servers'][$i]['controluser'] = 'root';


No. However, “root” is the default “user” for phpMyAdmin. The installation manual states:
“phpMyAdmin first loads libraries/config.default.php and then overrides those values with anything found in . If the default value is okay for a particular setting, there is no need to include it in . You’ll probably need only a few directives to get going; a simple configuration may look like this:”

$cfg[‘blowfish_secret’] = ‘1{dd0`<Q),5XP_:R9UK%%8"EEcyH#{o’;

$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;

I have tried this, but still getting same warning: " mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it."

As you can see by the warning, it appears that something in Windows 10 is refusing the connection. That’s why I initially stated that I didn’t believe it was a server problem, and I also pointed out, several times now, that I am able to log in to MySQL with the Command Prompt, and the commands associated with the MySQL server work: “status,” “show databases,” etc. So this isn’t a case where there is a problem with the MySQL Server 8.0. It is with the user interface, phpMyAdmin and my computer with Windows 10 preventing that program from connecting. Is it possible an addition to Environment Variables might correct the issue? I have tried disabling the built in Windows 10 firewall with no success.

What surprises me is that many people have been running into this problem (do as search on that warning), yet nobody has found a solution. I’m also surprised that no one at Sitepoint has heard of this before (apparently),

I did try an older version of phpMyAdmin, but got a different error …something about invalid index file. I don’t remember exactly what it said. In any case, my “user” and “password” are not being rejected …it is the connection that is being rejected. I think that is key to solving the issue. Everyone here has focused on the log in script in the config file. That isn’t it. I’m convinced. As the documentation states, very little is required in terms of directives for a minimal config file, and it implies one may not even need it at all if the default is okay.