The Computer Oracle

How to restart MySQL?

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Track title: CC O Beethoven - Piano Sonata No 3 in C

--

Chapters
00:00 Question
01:23 Accepted answer (Score 93)
01:56 Answer 2 (Score 16)
02:13 Answer 3 (Score 5)
02:41 Answer 4 (Score 2)
03:04 Thank you

--

Full question
https://superuser.com/questions/282115/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #ubuntu #mysql

#avk47



ACCEPTED ANSWER

Score 96


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



ANSWER 2

Score 16


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

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

 2. # service mysql restart



ANSWER 3

Score 5


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.




ANSWER 4

Score 1


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".