How can I run MAMP with two different login users at the same time on Mac?

4.2k Views Asked by At

I currently use Mac Mavericks OSX 10.9.1. I have 3 login users for work, school, and my personal user. I just installed MAMP on my 'work' user at first time. Apache and MySQL servers run successfully.

However, they are not runnable at all on either my personal or school user. When I run them on my personal user, MAMP showed below.

/Applications/MAMP/Library/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) when trying to connect

I don't know how to run them on the rest of my users.

Can anyone give me some solutions please?

4

There are 4 best solutions below

0
On

After try several ways I'm using this way now. Running the server as unix users.

What was the problem first- As I was trying to use if from different user account. It tried to start from user account, but the process was already from another user account. That's why I'm running the server as unix user as a common user and gave access to the htdocs directory to that unix user. Till now, it's working perfect.

enter image description here

enter image description here

0
On

Since your servers are runned by your work user other users may not have permission to access to your sock file. Try connecting your server by host 127.0.0.1 not by localhost which will open a tcp connection not a socket connection to test that is the case. If your server is running without a problem you should be able to connect without a problem. If that is the case solution would be granting read+write permission to /Applications/MAMP/tmp/mysql/ folder as well as your mysql.sock file if it is running by using shell command

sudo chmod -R 777 /Applications/MAMP/tmp/mysql/
0
On

This worked for me when I wanted to allow an employee to use my inhouse-developed inventory software that runs on the business's MacPro (macOS HighSierra 10.13.4) using MAMP free (4.2.1):

Be sure to stop MAMP servers and close the app before doing these steps.

1) Create a user/group account to use for running MAMP. For directions, go to https://support.apple.com/kb/PH25796

2) Install MAMP using this user/group OR (if already installed) change the owner/group of the MAMP files to this new user group. From Terminal:

    sudo chown -R MAMPuser /Applications/MAMP
    sudo chgrp -R MAMPgroup /Applications/MAMP

3) Change permissions on all the MAMP folders/files to let group members read, write and execute. (NOTE: This is for convenience, not security; investigate the implications of this if you are worried about other users messing up your install.) From Terminal:

    sudo chmod -R g+rwx /Applications/MAMP

Of particular importance were the mysql database folders /Applications/MAMP/db/mysql56, so if you have issues starting MySQL server, double check the permissions on the items in that folder.

4) Change the permissions on your Apache Document Root folder as appropriate to allow your php website to run for members of MAMPgroup. (NOTE: Again, this is for convenience, not security; investigate the implications of this if you are worried about other users messing up your website.)

    sudo chmod -R g+rwx <path-to-document-root>

5) Add user accounts that you want to be able to run MAMP to the MAMPgroup. For directions, go to https://support.apple.com/kb/PH25796

6) For each user, set up an Automator application with the following Utilities -> Run Shell Script command:

    sudo -u MAMPuser /Applications/MAMP/MAMP.app/Contents/MacOS/MAMP >/dev/null 2>&1 &

This runs the graphical MAMP app from the MAMPuser account no matter who is logged in.

For information on how to use Automator, check out https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/AutomatorConcepts/Automator.html

Make sure that users know to stop the servers and exit the MAMP app before they log out.

NOTE: It is possible to just create a group for any users who need access to MAMP. However, when a different user starts MAMP, a "MAMP wants to make changes. Enter admin name/pswd" pop-up appears. This solution runs the app under the same user account (sudo -u MAMPuser). There are glitches if MAMP is already running, so be sure that users always stop servers and exit MAMP when they are done.

1
On

I have not found a good solution to this issue as of yet... So one hacky way of doing it is to have two versions of MAMP installed. To do this, start by renaming the /Applications/MAMP directory to /Applications/MAMP-your_username. Then install the older version which will be then located in /Applications/MAMP. Simply toggle the names prior to opening MAMP at login. Or hey! Automate the name toggle with Automator at login :) Not the best solution, but it works for me until I find a cleaner way.