17

I'm using mysqld_safe to be able to create a password for my root user (under Ubuntu 18.04, it is not asked on the installation).

To start MySQL, I have done:

$ sudo mysqld_safe --skip-grant-tables&

Now, the MySQL daemon is running and I can't stop it. Stopping it by killing the process prevent me to start another MySQL daemon because the previous one did not gave back the resources, resulting in errors like:

2018-10-31T14:50:40.238735Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2018-10-31T14:50:40.238815Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

So how can I stop the MySQL daemon when it have been started using mysqld_safe?

darckcrystale
  • 1,582
  • 2
  • 18
  • 40
  • 1
    Stack Overflow is a site for programming and development questions. Maybe [Database Administrators Stack Exchange](http://dba.stackexchange.com/) would be a better place to ask. – jww Oct 31 '18 at 15:17
  • https://stackoverflow.com/questions/37879448/mysql-fails-on-mysql-error-1524-hy000-plugin-auth-socket-is-not-loaded – Kashyap Jan 10 '19 at 20:40

2 Answers2

31

The command is:

$ mysqladmin shutdown
darckcrystale
  • 1,582
  • 2
  • 18
  • 40
4

The other answers did not work for me. Had to to this sudo killall -KILL mysql mysqld_safe mysqld

Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
  • 4
    Never use this if you want to avoid database inconsistencies. Kill signal terminates MySQL instantly and if it has a running transaction that will prematurely end. QUIT signal (as @tadman wrote) avoids this situation and terminates MySQL properly. – Gabor Garami Mar 23 '21 at 13:50