I'm running Windows 11 and tried to install XAMPP on this machine. It installed Apache correctly, but when going to mySQL this appears:

mySQL cannot connect

I tried everything I found online to fix this problem in order to install WordPress locally. Then I "fixed" the problem following this tutorial Fixing connection to mySQL

After this, at least PHPmyAdmin opened. However, when installing Wordpress, it did not recognise the database (I created the database and made sure the password, the username and the name of the database were correct, together with the privileges). I spent countless hours trying each and every tutorial I found on the internet to solve this. In the end I resorted to installing XAMPP on a Windows 10 machine. Finally, everything worked out of the box (on Windows 10) without following any tutorials.

Any ideas of why this happened?

3 Answers 3


The picture says your credentials are incorrect. Try resetting the password for the MySQL user.


In fact, it looks like you didn't provide a proper configuration (last line in your screenshot). You need to have a config.inc.php file with appropriate credentials and server details (even in the localhost case) in the root of your phpmyadmin installation. See https://docs.phpmyadmin.net/en/latest/setup.html#quick-install-1 for reference.

Also make sure, that access for the respective user is allowed in the mySQL installation (individual database access but also mySQL configuration as well, in case of a root access https://linuxconfig.org/mysql-allow-root-remote-access, the latter being discouraged).

After that, of course make sure that your mySQL server is actually running and the firewall allows for access on the port (default: 3306) that you set, which should be the default case for connections to the localhost.

  • Thank you for your answer. The thing is that I did exactly the same on Windows 10 and it worked. However, on Windows 11 it always gives me error. I will try following the pages you recommended. Thanks a lot!
    – Johann
    Commented Dec 20, 2022 at 22:50

For those interested, I tried this solution and it worked. It still does not answer why I have to do this on Windows 11, while it works out of the box on Windows 10, but in the end, it got solved.

I share this for all of those who are going through the same issue. In this link, the author recommends changing some parameters in the confg.inc.php file to solve the problem.

Solution that worked

  • What a mess, migrated from Stackoverflow and it's a duplicate of this one on stackoverflow stackoverflow.com/questions/33824224/… Commented Dec 22, 2022 at 6:01
  • I don't know why, but after changing the MySQL port to 3307 it stopped working. When I changed again to 3306, it worked again. A note for those who can run into the same issue.
    – Johann
    Commented Dec 29, 2022 at 7:09
  • It would improve your answer if you added a summary of whats in the link. Commented Dec 29, 2022 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.