1

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:

  1. checked the server and mysql paramters in the config.inc.php file at \MAMP\bin\phpMyAdmin
  2. deleted in \MAMP\db\mysql the logfiles ib_logfile0 and ib_logfile1 and restarted the server.
  3. 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 problem Debugging errno: 2002, only the Apache worked but not the MySQL server.
  4. switched the ports from 80 to 8888 for Apache and from 3306 to 8889 for MySQL via the MAMP settings. I've also tried port 3307. Nothing was succesful.
  5. turned off my firewall and anitivirus software temporarily
  6. 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.

Community
  • 1
  • 1
rhmrx
  • 11
  • 3
  • I've installed the MySQL server, now the mysqld service is running but it's not connected to MAMP I think. In other works, if I start my servers then MAMP says MySQL must use Port `3306` but it's already used by mysqld. I can click _Use next free port_ which would be `3307` or _Setup new port_. If I click 'Use anyway' nothing happens. I'm not sure which of the solutions should help me with my problem. Also, I don't have the `etc` or `var` folders nor do I have the _socket file_ they are talking about. – rhmrx Aug 10 '19 at 16:43

0 Answers0