MySQL said: Cannot connect: invalid settings. | mysqli_real_connect(): (HY000/2002): No connection..


This is a very common MySQL problem that is has very few answers out there. I thought I would create a quick video on how you can easily fix this problem.

The Errors that I get are the following:

-“mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.”
-“phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.”
-“MySQL said:
Cannot connect: invalid settings.”

The fix is extremely simply, all it takes is going into the my.ini file for mySQL on XAMPP and switching the port setting. Oftentimes the port is set to a different port than it should be.
In my case it was set to port 3308, and so I switched it to the default port for mySQL which is port 3306 and this fixed the problem for me. If you have any questions please let me know, and I will do my best to answer them for you.


Xem thêm bài viết khác:



Please enter your comment!
Please enter your name here