Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Can't install MAMP because PORT are not free

When I tried to connect MAMP it give me a message that MYSQL need a free port and the current port is used by another program or application.

I can't understand what program/application is that using that port? how can I check it or open another port for it to work???

9 Answers

Hey Shon,

Look in your /Applications/Utilities folder for an application called Network Utility. Go to the tab that says Port Scan and search under localhost for your specific port number. If the port is being used, the process that's using it will show up there.

Not sure what you mean by "when I try to connect MAMP"?

Do you get the error message when you try to start it, or when you try to connect to it using something like phpMyAdmin?

Or do you get the error when, e.g., you try to test a PHP page?

If you can start it, go to the MAMP window (the popup that shows up when you start it), there's a button/link for Preferences. If you click it, and then click the tab for Ports, you will see which port the web server (Apache) is trying to use, and the port the database server (MySQL) is trying to use. The MAMP defaults are 8888 and 8889. You could change these to 80 and 3306. If you use the MAMP defaults then in a web browser you need to enter localhost:8888/website_name/... If you use port 80 then localhost/website_name/... should work.

I kind of get some part of the error: In the Task Manager there is a program called "mysqld" which is located in "D:\Program Files\MAMP\bin\mysql\bin"

When I start the MAMP first time it working but when I close it and restart it it says me that the port isn't free - the program is still opened - if I close it manually it connect again

what is the problem?? why the mamp don't close it by itself???

Ah ha! That's a known bug with MAMP. Happens to me once in a while. But infrequently. Never was able to figure out if it was something I was doing differently. A couple of years ago I was teaching a group of about 12 and this problem kept happening to 2 of them regularly and to no one else in the class!? We watched them start and stop MAMP. Couldn't ever see them doing anything differently.

Thanks for letting me know that this is a common problem :) I search in the internet for solution but nothing but manually... :\

I think I will delete MAMP and install WAMP Server...

Thanks everyone :)

Shon, MAMP is for Macs, WAMP is for Windows. Aren't you on a Mac?

Well no... I looked at this video tutorial: https://teamtreehouse.com/library/windows-local-php-dev-environment

It says Windows... :S

OK, but there are instructions for Mac as well: https://teamtreehouse.com/library/mac-local-php-dev-environment

Frankly, I'm surprised that MAMP worked at all on a Windows machine.

A while ago, the lines between MAMP and WAMP were blurred. They are less OS dependent than they use to be.

Good to know. Thanks. Never tried it. Was always of the belief that the 1st M in MAMP was Mac, and the W in WAMP was Windows.

Thats how it was when I started too! Mamp for Mac, Wamp for Windows (however I perferred XAMPP over Wamp). But in the last year or so Mamp released a Windows compatible version in addition to their Mac product.

The best solution is to reconfigure the XAMPP Apache server to listen and use different port numbers. Here is how you do it:

1) First, you need to open the Apache “httpd.conf” file and configure it to use/listen on a new port no. To open httpd.conf file, click the “Config” button next to Apache “Start” and “Admin” buttons. In the popup menu that opens, click and open httpd.conf

If you can't find this (I couldn't), search your C;drive for apache and find the config file

2) Within the httpd.conf file search for “listen”. You’ll find two rows with something like:

Listen 12.34.56.78:80

Listen 80 Change the port no to a port no. of your choice (e.g. port 1234) like below

Listen 12.34.56.78:1234

Listen 1234

I had the same problem last week and this worked for me. I found the answer at the following address http://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port (answer starts about half way down page) and there is more, but that was all I had to do to get mine to work. Good luck

Sorry, I have just realised that your MYSQL port is taken, not Apache, However, the principal is probably the same, just in the MYSQL fconfig files instead of the Apache config file.