My problem started with my XAMPP (on Windows 10). I couldn't access my phpMyAdmin anymore because the access was denied for some reason. I tried a bunch of different things and eventually re-installed XAMPP but that didn't fix the problem either, instead everything got worse. I tried to install MAMP as an alternative to XAMPP. When I first started MAMP, after the installation I could access the dashboard as well as phpMyAdmin - everything worked just fine. But as soon as I stopped the server and re-started him, the MySQL didn't work anymore. I re-installed MAMP several times now and it's always the same procedure. It works just after the installation but as soon as I restart the server it doesn't.
I've checked a lot of different threads on stackoverflow and other portals.
Other things I tried:
- checked the server and mysql paramters in the
config.inc.php
file at\MAMP\bin\phpMyAdmin
- deleted in
\MAMP\db\mysql
the logfilesib_logfile0
andib_logfile1
and restarted the server. - deleted in the same folder all files that are called
mysql-bin.
and restarted the server. I started the servers, the green light turned on (Apache and MySQL), the servers worked and I could access them. But as soon as I stopped the servers and re-started them, I've got the same problemDebugging errno: 2002
, only the Apache worked but not the MySQL server. - switched the ports from
80
to8888
for Apache and from3306
to8889
for MySQL via the MAMP settings. I've also tried port3307
. Nothing was succesful. - turned off my firewall and anitivirus software temporarily
- installed MAMP on different partitions (first I tried the standard directory C://MAMP/ for sure)
I wrote a little bit of PHP code to check the connection:
<?php
$link = mysqli_connect("localhost", "root", "root");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
mysqli_close($link);
?>
After the installation of MAMP I get this:
Success: A proper connection to MySQL was made! The my_db database is great. Host information: localhost via TCP/IP
After restarting the MAMP servers I get this:
Error: Unable to connect to MySQL. Debugging errno: 2002 Debugging error: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte.
Translation: Unable to connect because the target computer refused the connection.
When I try to open phpMyAdmin I get this: https://i.ibb.co/vxCxx5R/error-phpmyadmin.jpg (Cannot post the image directly due to missing reputations.)
I have no clue what causes the problem but I have the gut feeling that is has either something to do with the ports or the MySQL service. Though, I can't find any port that is blocking the port 3306. I've tried to run the mysql.exe
and mysqld.exe
but nothing happens. I've also tried to run them as an administrator, even though I've got administartor rights already. The terminal pops up for less than a second and that's it, I can't find any service that is running.