Trouble connecting to MAMP - This site can’t be reached localhost refused to connect.

The Error


Is confirmed to be working correctly. The site I had previously set up launched correctly. That site's database was created using MAMP. My site folder is using a database downloaded from an existing website.


  • Located in MAMP/db/mysql57/wordpress
  • Downloaded from existing website
  • Confirmed that DB name and table prefix are correct in Sequel Pro
  • wp-config.php data changed to:

define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');

define('AUTH_KEY', 'OMITTED');
define('NONCE_KEY', 'OMITTED');
define('AUTH_SALT', 'OMITTED');
define('NONCE_SALT', 'OMITTED');

$table_prefix = 'wp_yky5t9gacn_';

define('WP_DEBUG', false);
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');


Site Files

  • Located at MAMP/htdocs/wordpress

PhpStorm Config

Comment actions Permalink

I am not really sure how this issue is related to PhpStorm - MAMP runs on its own, not involving PhpStorm in any way.

The error you see in your browser means that nothing listens on port 80 of your machine.

Is it expected that you're trying to connect to 80 and not 8888 (the port you have specified in PhpStorm)?

Comment actions Permalink

Why do you say that it's trying to connect to port 80? Is that because no port is in the url so it defaults to 80? 

I'm going http://localhost:8888/ and selecting the site link. That takes me to localhost/wordpress/. I thought it should say localhost:8888/wordpress/.


If it isn't where would I change that? I've already corrected my wp_options table to direct to localhost. 

Comment actions Permalink

I have no idea what browser that is, but AFAIK Safari hides the port number, so consider using something else, just for troubleshooting.

Then, please try running the following command

nc -z localhost 8888

And show me the output.

Comment actions Permalink

I'm using Chome. 

Output: Connection to localhost port 8888 [tcp/ddi-tcp-1] succeeded!

Comment actions Permalink

Ok then, at least Apache is really running.

Try pasting this exact string into the browser address bar, don't use any completion/suggestions:

Comment actions Permalink

It redirects to http://localhost/wordpress/


Please sign in to leave a comment.