How to restart MySQL?

You should really use the Sys-V init scripts located in /etc/init.d.

Start:

sudo /etc/init.d/mysql start

Stop:

sudo /etc/init.d/mysql stop

Restart / reload configs:

sudo /etc/init.d/mysql restart

Check run status:

sudo /etc/init.d/mysql status

In Ubuntu machines, you can restart the mysql using both commands :

 1. sudo /etc/init.d/mysql restart

 2. # service mysql restart

To shutdown mysql, run:

mysqladmin -uuser -ppassword shutdown

where user and password is that for a user with the proper SHUTDOWN privilege

To check that it has been shut down:

ps aux | grep mysql

If any processes (other than the 'grep' command) show up, it hasn't been shutdown.


You can use kill -9 "PID" command to do that, the MySQL Process ID (PID) you can get running ps -a or top commands. Then you can start it again by calling ./"main process".