How to kill mysql with moving pid

11,644

The process probably is probably respawning each time when you try to kill it.

You can always try to use pgrep and kill them at one go, e.g.:

kill $(pgrep mysql)

But I think the solution would be to find the source where it's get restarted each time, so try checking list of your running/system daemons by using launchctl:

sudo launchctl list

Then unload as described in: How do you stop MySQL on a Mac OS install?

If you've the problem with:

[ERROR] Can't open the mysql.plugin table.

probably you're running it wrong, by not specifying the right mysql data directories. So maybe it's worth to load them again via launchctl, check how they were run before, or locate your configuration file and double check the configuration, or you've the wrong permissions set-up.

Here is sample syntax how you can run it manually:

mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/var/db/mysql --datadir=/var/db/mysql --plugin-dir=/var/db/mysql/lib/plugin --user=mysql --tmpdir=/tmp/mysql/tmpdir --log-error=/var/log/mysql_error_log.err --pid-file=/tmp/mysql/mysql.pid --socket=/tmp/mysql/mysql.sock --port=3306

When using MAMP, the command-line parameters looks like:

/Applications/MAMP/Library/bin/mysqld --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --basedir=/Applications/MAMP/Library --datadir=/Library/Application Support/appsolute/MAMP PRO/db/mysql --plugin-dir=/Applications/MAMP/Library/lib/plugin --user=mysql --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --log-error=/Applications/MAMP/logs/mysql_error_log.err --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --socket=/Applications/MAMP/tmp/mysql/mysql.sock --port=3306 
Share:
11,644

Related videos on Youtube

icicleking
Author by

icicleking

Reluctant Drupal Developer

Updated on September 18, 2022

Comments

  • icicleking
    icicleking over 1 year

    I have multiple mysql instances running on OSX 10.10. /usr/local/mysql/bin/mysqld stop spits out a bunch of warnings and errors, I'm not sure if they're worth sharing. Here's the first error 16164 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. Running mysql_upgrade fails.

    Running ps aux | grep mysql results in:

    clayton         16179   0.0  0.0  2423356    228 s000  R+   10:58AM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql
    _mysql          15599   0.0  0.3  3070756  24508   ??  S    10:22AM   0:01.64 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/Beast.local.err --pid-file=/usr/local/mysql/data/Beast.local.pid
    root            15514   0.0  0.0  2452828    876   ??  Ss   10:22AM   0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql
    

    I tried kill the processes sudo kill -15 16179 15599 15514, but my user process pid changes. kill: 16179: No such process. If I do ps aux | grep mysql repeatedly the pid of the first process, owned by clayton, jumps up by 10 each time.

    So, next I tried to unload mysql using launchctl unload /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist and launchctl unload /Library/LaunchDaemons/com.mysql.mysql.plist result in Could not find specified service.

    Ugh. I'm definitely stumped and not sure how to proceed. Any suggestions?