MAMP: Craft can’t connect to the database with the credentials in craft/config/db.php I'm using MAMP to setup a local environment for CraftCMS on Windows 10. 

I have followed all necessary procedures and have my local host and my database setup but I'm still receiving the error mentioned above.

My db.php is shown as this:

 return array(

        // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
       'server' =&gt; 'localhost',

        // The name of the database to select.
        'database' =&gt; 'mycraft',

       // The database username to connect with.
       'user' =&gt; 'root',

       // The database password to connect with.
      'password' =&gt; 'root',

       // The prefix to use when naming tables. This can be no more than 5 characters.
      'tablePrefix' =&gt; 'craft',

 );


Even if i make a custom user or password I still get the error above when I try to connect to http://localhost:8888/admin

I've checked many times and all my credentials as well as my local host port is correct. Craft can clearly connect to host which is why I'm getting the error from craft but for some reason, despite the details in db.php being correct it cant connect to the database...

Anyone know what's going on?
The default MAMP DB credentials are indeed root:root, as you have already, so you should check that you did indeed create a database (set up as detailed here) and that it is indeed called ‘mycraft’.

Also check in your MAMP control panel that the MySQL is actually running: