9

I have a mid 2013 MBA running OSX 10.9.

The process that starts on every start up is mysqld. I believe it was from an old version of MySQL I had installed (via AMPPS). I then installed MAMP Pro and I often have conflicts between these two processes. Everytime I shut down and restart my mac, I have to find the process of mysqld that is running (on activity monitor), quit it, and then start MAMP (via the terminal command: /Application/MAMP/bin/startMysql.sh won't work from anywhere else).

So I'm wondering how I can disable this mysqld from running on every startup.

  • Are you able to run ps to track the parent process and see what is starting mysqld? – bmike Dec 12 '13 at 21:32
  • Let's see if someone has more targeted information. Tracking processes and killing them from terminal isn't the easiest to write up. You can get the same information from Activity Monitor - select mysql - then info, then look for the parent process. – bmike Dec 12 '13 at 22:31
  • 1
    Possible helpful answer from Superuser: superuser.com/a/334622 – Mikey T.K. Dec 12 '13 at 22:53
  • Not sure if this can help because it is for applications launched at start, However have a look into System Preferences >> Users and Groups >> Login elements. You will find the app that are launched at startup. – FeliceM Dec 13 '13 at 9:09
  • Are you sure it's AMPPS and not just MAMP running at startup. Restart the computer and enter 'ps -Awww | grep mysql' in the terminal. This should at least tell you which executable is running. – MJ Walsh Dec 31 '13 at 17:05
9

Open terminal, then:

sudo launchctl list | grep -i mysql

launchctl remove xxx.xxx.mysql

Where "xxx.xxx" is included in the output of the first command, for example "org.macports.mysql". The password for the "sudo" command is your own user account's password.

True, sudo isn't needed to "list" but because you already gave a sudo password for the first command, it is stored for a short while in session memory and isn't required for the second command (which is privileged). Otherwise, just skip sudo on the first command and use it on the second. There are more ways than one to skin a cat.

  • 2
    sudo launchctl list | grep -i mysql yields no result. Neither does sudo launchctl list | grep -i mysqld i.imgur.com/WZ5EVjw.png – Xecure Dec 13 '13 at 22:34
  • You could use the AMPPS Admin Panel to disable the AMPPS MySQL daemon. Or better yet, just uninstall AMPPS altogether since you have another framework installed now. – user64759 Dec 15 '13 at 9:19
  • I've uninstalled AMPPS and I still have this problem. – Xecure Dec 15 '13 at 18:03
2
+25

If the version of MySQL that was previously installed originated from the MySQL Community Downloads page on the SUN/Oracle site, it's likely that launchd is not involved with startup of the mysqld process. For some reason, the startup script that is distributed with MySQL uses the deprecated "Startup items" technology to start processes at boot. In fact, even the current binary distribution (5.6.15) of mysqld uses StartupItems to start the server on OS X(?!)

The startup script that's launching the conflicting version of MySQL is most likely located at /Library/StartupItems/MYSQLCOM/MYSQLCOM. At boot time, that startup item will examine the file at /etc/hostconfig to determine if the setting for the "MYSQLCOM" variable is set to "-YES-". If so, the startup script will launch mysqld.

It should be possible to disable the startup of MySQL by modifying the line in /etc/hostconfig that specifies MYSQLCOM=-YES- to say MYSQLCOM=-NO- (which should disable the startup process on the next boot).

You can terminate the currently running instance of mysqld by performing the command:

sudo /Library/StartupItems/MYSQLCOM/MYSQLCOM stop

To permanently disable the startup of the wrong mysqld process, it should be possible to first stop the daemon using the command above, and then to remove the MySQL startup item using the following command:

sudo rm -rf /Library/StartupItems/MYSQLCOM

Note: you may also have the MySQL Preference Pane installed at /Library/PreferencePanes/MySQL.prefpane or ~/Library/PreferencePanes/MySQL.prefpane...That preference pane can also be removed to 'cleanup' pieces of the old MySQL installation.

1

It might be easier to rename the mysqld (or move / back up / delete it) and then restart and look for the error message for the launch item that was trying to start the program that is no longer available.

The other answers seem to cover the tack of looking for Launch Agents and Launch Daemons as well as tracing the PID which generally doesn't work for daemons since they usually have a parent PID of 1.

Also, since mysql isn't shipped with Mavericks, you should be able to track the install package you selected or use mdfind mysqld to locate the package that brought that database to your Mac and then locate the uninstall / disable instructions for that package of mysql. You'll also want to look in system preferences in case you have installed a control there to start the software.

  • mdfind mysqld does not show any AMPPS related MySQL files, just MAMP related files (and a few other from either MySQL programs I have installed like MySQL Workbench) – Xecure Jan 7 '14 at 20:30
1

Start off by finding out what the parent process is that started your mysql. From the Terminal run a ps command to find out what the process is; you can use -j or -l to list out the parent id ppid. So this will show you:

$ ps -axjc | grep mysql

The first column is your userid, the second is the process id, the third is the parent id.

If the parent id is 1 then it will have been launched by the root launch daemon, which probably means it's coming from one of the LaunchDaemons or StartupItems. If it comes from a process that isn't 1 but that is a launchd process then that's probably the LaunchAgents or is in your system login items.

root                1     0     1      0    0 Ss     ??    4:49.10 launchd
alblue            257     1   257      0    0 Ss     ??    0:16.29 launchd
_spotlight        415     1   415      0    0 Ss     ??    0:00.94 launchd

So process 1 is launched by system startup, and anything with the parent process of 1 comes from the system daemons. Anything (in this case) with a parent process of 257 is being launched from one of the LaunchAgents or LoginItems.

Bear in mind that the name of the launch daemon or startup item doesn't necessarily have 'mysql' in the title - it could have been run by a different program or login item (so simply searching for it by name might not find it). Once you've found what has launched it, you may be able to find out where it came from.

1

The following worked for me with mysql 8.0.12 installed using Homebrew in macOS Mojave 10.14.1:

rm -rf ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • It worked for met on homebrew installed mysql. thanks. – Almas Dusal Mar 20 at 0:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .