Developing on your local machine instead of a webserver saves a developer a lot of time and allows you to test functionality without the need for a test site. There are a couple of tools to allow someone to set up a server on their local machine; one of the most common tools is MAMP.
In using MAMP for a couple years there are a few gotcha's that I've run into that are actually quite easy to fix if you know what to look for.
Apache Server Not Starting
If Apache isn't starting is could be that Apache may already be running. You can turn off Apache manually in the terminal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apachectl stop |
The other problem that I've had is when Apache is set through MAMP to open a particular folder and that folder no longer exists. If you simple go to MAMP and change that setting through the preferences button you should be able to fix it.
MySQL Not Starting
If MySQL isn't starting it is pretty likely that it could already be running. You can very easily manually turn it off in the terminal. I've had this happen to me a few times and I believe it has something to do with not shutting MAMP off correctly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
killall -9 mysqld |
MySQL Error #2002 –Β The server is not responding
You sometimes get this problem on the phpMyAdmin page when you've had another MySQL problem. This is actually just a caching problem. Just add a query string to your url or clear your cache and it should fix itself.
Conclusion
These are the only problems I've had with MAMP and they are quite easily fixed. Hopefully these little tips will save you some time.
Thanks for your post! My student had the wrong folder name in the MAMP settings which caused Apache not to start. The note under the sude apachectl stop command is what tipped me off to look for that and it worked. Kudos!
Glad to hear it! It’s amazing how this little problems can suck hours out of our day if you don’t know where to look to solve them. π
Fair play! i had the phpadmin problem. searched everywhere and had all sorts of complicated answers. Then i cam across your cler cache answer!!! I always clear my cache, but i never thought it would affect the phpmyadmin!
I was close to reinstalling mamp. You saved me : )
how did you do it?
I was not aware that you can clear cache via query string. Can you please provide example format?
Good Q! When you add a query string to a URL you don’t clear you cache but you do force your browser to fetch a new copy of the html file. Effectively clearing the cache for yourself. π
Hi, I’m struggling to resolve an issue with MAMP and came across your post. Wondered if you had any ideas how to resolve?
I’ve been developing a handful of sites without any issues using Yosemite and MAMP. I’ve recently done several updates for OS and now MAMP isn’t loading my localhost in browser (Chrome) http://localhost/MAMP/?language=English, it keeps throwing up this error message: ERR_NAME_NOT_RESOLVED.
I’m running the latest version of MAMP 3.2.1 on Yosemite 10.10.3
Apache and MySQL lights are green. I’ve tried MAMP default ports and 80/3306, I’ve tried rolling back to the previous install of MAMP, tried incognito browsing and Firefox, cleared cache … all without success. Any idea of how to resolve?
Hey Matt,
I running the latest Yosemite as well. I haven’t seen that problem before. Sorry. π
Hey Patrick, thanks for your reply.
I managed to solve the problem; there was something wrong within my host file in etc.
Back to normal functionality now.
Happy coding!
I’m having the exact same problem. MAMP was working fine until this morning I got this Error:
ERR_NAME_NOT_RESOLVED
I have tried everything you had in the post above. Can you help with what you corrected in your etc/host file to fix the problem?
Nevermind Matt,
I just found another one of your posts pertaining to this problem elsewhere and found your solution
Thanks Again!!!!!
how to access the host file? Please?
i gave up using mamp
everything went smooth installing, but when i try go to htdocs result is not found,
Was having to many issues with MAMP, now using Desktop Server for all local development, their support is outstanding.
Patrick! Who are you sir and why don’t you aren’t you teaching courses on Udemy?! You resolved my MAMP problem! For the past 24 hours I have been depressed because I could not connect to mySQL server via MAMP and so my WordPress theme development was cut short. Imagine the time and money lost if I was doing this for a client!? Patrick, you have a new friend and follower. God bless you sir.
I may have to start using Dekstop Server, because I cleared this cache again today and that has not resolved anything. The issue is that it does not connect to the MySQL server, it seems a lot of people have problems with MAMP. I don’t know why folks insist on using it. It’s like Photoshop, the new version has a lot of problems right from download and all these companies insist you know how to use Photoshop.
I highly recommend Desktop Server, having switched over from Mamp several months ago, I haven’t looked back since! I was having way too many issues with Mamp on every upgrade and found the interface frustrating.
Desktop Server is very simple to set up new local development sites, with a 2 click process and their support is outstanding β even for the non premium version!
Make the switch and your workflow will improve immensely!
Happy coding π
When i do a killall, my terminal simply tells me no matching processes found. I have come to hate MAMP
Dear Sir, I am facing the same problem with mamp, could you please define command for windows user ? apache and mysql both are not starting, I want to share one thing that I was using xampp before mamp, so is it the reason? that xampp may be using 80 port? please help me out. thanks…
Hey,
I was using MAMP to build my WP page and got half way through the project. Last night MySQL wouldn’t connect so I read to delete anything non folder in the db folder in Applications>MAMP. This did reconnect the server BUT when I went to my local host URL to continue working it brought me to the install WP page.
Any thoughts on how to get back into my dashboard or why this happened in the first place? I dont mind starting over I just want to know what to do if it happens again.
Thanks
I just had this same issue. I deleted everything except the folders and now its forcing me back to the WP install page in an infinite loop punctuated by database errors. I hope we can find a solution to this.
Why on earth did I move htdocs? I know better than that! Thanks for the tip, Apache web server started now.
Hello Patrick!
I have been with this issue for a few days now, and figured out that I was setting my Document Root to a folder that no longer existed, thanks to your explanation.
I wanted to thank you for your post!
Regards,
Lucas
Hey Patrick,
I have installed WordPress and local hosted with MAMP. It was working perfectly, but then the phpmyadmin database disappeared (I may have run a sudo command that i didn’t understand) so I reinstalled the database and wordpress.
Now the fresh wordpress install loads when i go to localhost:8888 but it displays the following error when I try login to wordpress;
This site canβt be reached
localhost refused to connect.
ERR_CONNECTION_REFUSED
Hi Patrick:
I know this an old post but I could really use your help.
I tried everything you suggested, but no success!
I had everything working, built a site then had a power outage. Hadn’t used my computer over the weekend and when I came back had the MySQL Error #2002. I’ve tried even going back in my Time Machine and still can’t get it to work. When I start MAMP the Apache Server starts but the MySQL Server doesn’t.
I used MAMP years ago (in fact back when you wrote this) without the problems I’m having now.
Any help would be greatly appreciated!!!
Cheers, Vince
Hi All,
I’m not able to start or restart my Mamp mysql because usually it alert me, Apache couldn’t be started because port 8888 is in use by some other software.
I used the commands
sudo apachectl stop
killall -9 mysqld
but still facing the same issue, BTW i’m using mac
Hello,
Just wanted to say thanks. It’s 2018 and Mamp pro v4.5
I upgraded from v3 and found that I could use only port 8888 for Apache.
though I had no problems with mamp pro v3.
Your solution seems to work fine – so far.
I was using MAMP PRO 4.0.2. I tried to up grade to MAMP PRO 5.0.4. When I did my admin screen stop appearing. I am not able to log back into my WordPress site. I keep get the message ” Not found The requested URL /Base -1/wp-login.php was not found on this server.” I tried using port 8888 and port 80. That did not work. Can you please help me resolve this problem; or tell me how to get into my WordPress web site without using MAMP PRO again after using it initially.
which version will be best for IIS server, 3.5 .Net Framework or 4.5 .Net Framework?, actully we are getting error run wordpress website include with ASP .Net code.