How to stop MySQL after running it using mysqld_safe?

Viewed 16411

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?

2 Answers

The command is:

$ mysqladmin shutdown

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

Related