3

I'm trying to stop Mysql v5.1 on MacOSX 10.6 so that I can upgrade to Mysql v5.5.

I believe I installed v5.1 from source many months ago. I've attempted all the methods listed here: How do you stop MySQL on a Mac OS install?.

However when I do a "mysqladmin shutdown" it seems the os just spawns another mysql process:

$ sudo mysqladmin shutdown
$ ps -Af | grep mysql
   74 53283     1   0   0:00.01 ??         0:00.01 /bin/sh /usr/local/mysql/bin/mysqld_safe
   74 53324 53283   0   0:00.01 ??         0:00.03 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --log-error=/usr/local/mysql/var/Al.local.err --pid-file=/usr/local/mysql/var/Al.local.pid
  501 53343 52577   0   0:00.00 ttys003    0:00.00 grep mysql

The same thing happens if I try to kill the process. (However if I try to kill the mysqld_safe process I get "No such process")

I've looked in /Library/StartupItems and there's no MySQL directory. I know I didn't use MacPorts to install Mysql.

What am I missing here? How do I slay this beast?

Community
  • 1
  • 1
Sly
  • 743
  • 13
  • 38
  • your mysqld_safe's parent PID is 1, which means it's `init`. So your mysql is being started as part of system start up. I'm not familiar at all with OSX, but is there a /etc/init.d or similar on top of the startupitems folder? – Marc B Jul 14 '11 at 17:41
  • Justin - even a kill -9 doesn't kill it: $ sudo kill -9 53283 53324 Password: $ ps -Af | grep mysql 74 54610 1 0 0:00.01 ?? 0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe 74 54672 54610 0 0:00.08 ?? 0:00.10 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --log-error=/usr/local/mysql/var/Al.local.err --pid-file=/usr/local/mysql/var/Al.local.pid 501 54674 52577 0 0:00.00 ttys003 0:00.00 grep mysql – Sly Jul 15 '11 at 02:51
  • 2
    Marc B - you provided the hint! As it turns out there is a file: /Library/LaunchDaemons/com.mysql.mysqld.plist that was preventing mysql from shutting down. Once I removed it and rebooted mysql went away. This stackoverflow post has more details: http://stackoverflow.com/questions/5555589/mysql-5-5-10-mac-10-6-x-auto-start – Sly Jul 15 '11 at 03:23
  • Marc B - if you post the answer I'll check it. Thanks for the keen eye! – Sly Jul 15 '11 at 03:24

3 Answers3

12

@Sly -- your fix works nicely. However, if you didn't want to restart I found (in man launchctl) that you can also make it stop restarting mysql by issuing the following command:

sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist

PS: Your com.mysql.mysqld.plist file may be in /Library/LaunchDaemons or /Library/LaunchAgents or in ~/Library/LaunchDaemons or ~/Library/LaunchAgents

steve
  • 3,276
  • 27
  • 25
2

I have a similar install without the launcher daemon. I run mysqld in a terminal. I find the only way I can shut it down is by sending signal 11 to the mysqld process.

Douglas Held
  • 1,452
  • 11
  • 25
1

MySQL is started using launchctl take help of launchctrl to unload it

  launchctl interfaces with launchd to load, unload daemons/agents and generally control launchd

Try unload the should resolve the Issue

sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist

if mysql has not loaded using the launchctl utilty then unload will not stop the mysql then in this case the regular sudo mysqladmin shutdown will work

anish
  • 6,884
  • 13
  • 74
  • 140