0

Short version: I started mysql with mysql_safe and I can't kill it.

Long version: Installing an older version of mysql with macport displayed this suggestion:

$ sudo port install mysql55-server
--->  Computing dependencies for mysql55-server
--->  Fetching archive for mysql55-server
--->  Attempting to fetch mysql55-server-5.5.49_0.darwin_14.noarch.tbz2 from https://packages.macports.org/mysql55-server
--->  Attempting to fetch mysql55-server-5.5.49_0.darwin_14.noarch.tbz2.rmd160 from https://packages.macports.org/mysql55-server
--->  Installing mysql55-server @5.5.49_0
--->  Activating mysql55-server @5.5.49_0

If this is a new install you might want to run:

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db

Running that gave these instructions:

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db
Installing MySQL system tables...
161102 13:15:44 [Note] /opt/local/lib/mysql55/bin/mysqld (mysqld 5.5.49) starting as process 54176 ...
OK
Filling help tables...
161102 13:15:44 [Note] /opt/local/lib/mysql55/bin/mysqld (mysqld 5.5.49) starting as process 54180 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/opt/local/lib/mysql55/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql55/bin/mysqladmin -u root -h myusername password 'new-password'

Alternatively you can run:
/opt/local/lib/mysql55/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/local ; /opt/local/lib/mysql55/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /opt/local/mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

At this point I (unwisely, it seems) ran:

$ cd /opt/local ; /opt/local/lib/mysql55/bin/mysqld_safe &

Now I cannot figure out how to stop the mysql and/or daemondo process(es):

$ ps aux | grep mysql55
myusername        54937   0.1  0.0  2432772    660 s001  R+    1:39PM   0:00.00 grep mysql55
_mysql         54888   0.0  0.1  2667884   6340   ??  S     1:36PM   0:00.12 /opt/local/lib/mysql55/bin/mysqld --user=_mysql
root           54885   0.0  0.0  2479468    700   ??  Ss    1:36PM   0:00.00 /opt/local/bin/daemondo --label=mysql55-server --start-cmd /opt/local/lib/mysql55/bin/mysqld --user=_mysql ; --pid=exec

I've tried many variations of kill, targeting both mysql (which seems pointless) and daemondo, including (but not limited to) the following:

  • sudo kill -9 54888 // killing the mysql process results in a new pid
  • sudo kill 54885 // the doemondo process
  • sudo kill -SIGHUP 54885
  • sudo killall mysqld_safe
  • sudo kill -9 54822 // a reincarnation of the doemondo process
  • sudo mysqladmin shutdown
doub1ejack
  • 10,627
  • 20
  • 66
  • 125
  • There are good ideas here: http://stackoverflow.com/questions/11091414/how-to-stop-mysqld ? – Schipe Nov 02 '16 at 18:11
  • @Schipe Yes, many of my failed attempts were drawn from that post. Many of those suggestions are specific to a package manager (brew or macport) which doesn't help because I ran `mysql_safe` directly. Other solutions target mysql, which doesn't help me because once killed, the mysql process is recreated. Thanks, but I am looking for an answer specific to `mysql_safe`. – doub1ejack Nov 02 '16 at 18:21
  • `mysqladmin shutdown` should certainly have worked. `mysqld_safe` should allow MySQL to terminate if it stops voluntarily, rather than crashing or being killed, but you have to specify `-u` and `-p` with `mysqladmin` of course. – Michael - sqlbot Nov 02 '16 at 23:43
  • This one worked for me: https://stackoverflow.com/questions/37879448/mysql-fails-on-mysql-error-1524-hy000-plugin-auth-socket-is-not-loaded – Kashyap Jan 10 '19 at 20:41
  • @Michael-sqlbot, it won't in case this is the initial setup and you have issues with password. You could get `auth_socket` issues. – Kashyap Jan 10 '19 at 20:42

1 Answers1

2

For centos or mint

 /usr/bin# initctl 

for ubuntu

 pkill mysqld
jai dutt
  • 780
  • 6
  • 13
  • 1
    Off-topic .... regarding your comment: "if every buddy do enough research then no need o open sites like stack* ... you might want to actually take the helpcenter tour again to understand the defined purpose of SO. Meaning: if you think the sense of SO is about "you not doing your own research"; then sorry you do not understand what SO is about! – GhostCat Nov 02 '16 at 18:56