no localhost in MAMP


I installed MAMP on my laptop yesterday and had relatively little difficulty getting it up and running. Today, I've moved the laptop out of range of the wireless network, so it has no internet connection. But I thought I should still be able to write PHP webpages that point to the mySQL database on my laptop. Although myPHPAdmin is working just fine, and I can easily manipulate the data there, Firefox seems unable to do anything that requires a connection to "localhost." Any ideas on how I should be pointing the mysql_connect command? I've tried localhost:8889, which is the specific port where mySQL is supposed to be, and I've tried simply putting in the file path to where the database is stored, but neither worked.

Thanks in advance.


Try this:

Click on the server tab in Mamp.
click on the select MySQL root password. create one; for the example I'll call it "password",

then, your php code must start like this:
mysql_connect("localhost", "root", "password");
php code....

Mamp doesn't support a root without password.