how do I stop mysql running on my server? Standard solutions not working
Emily Wong
I have done a remote log-in into my Ubuntu 14.04 server as a root user.
When I try:
sudo stop mysqlI get:
stop: unknown instance:When I try:
sudo service mysql stopI get:
stop: unknown instance:I read a post somewhere where someone posted a similar question, the answer being that the server is most likely already not running so I tried:
mysqladmin -u root -p statusAnd I get Uptime: 1543 Threads: 1 Questions: 500 etc...
...which means the server is indeed running.
So, how do I stop mysql? I'm sure I tried sudo stop mysql before and it worked.
Today I added a password for access to the mysql db as a root user, could that be something to do with it?
I know the password is working ok because I need to enter it in order to log into phpMyAdmin.
With service mysql status I get mysql stop/waiting like it's hanging - shouldn't it just shut down eventually?
5 Answers
Try sudo systemctl status mysqld then, if successful, sudo systemctl stop mysqld.
The name of the service may be different (officially is mysqld).
Stop MySQL: sudo /etc/init.d/mysql stop
Stop Apache: sudo /etc/init.d/apache2 stop
You are missing the command 'Service'.
sudo service mysql stop
1Here is how I did it eventually.
I looked up the Process ID (PID) for mysqld_safe using:
ps -AThis will show all the PIDs currently running on the server.
mysqld_safe was something like 34567
Then I did the command: kill -KILL 34567
Also, I killed the PID of mysqld, which was something like 34678:
kill -KILL 34678Then I did service mysql start
All working good now.
The problem with sudo service mysql stop is that systemctl will restart the service after a few minutes. You need to stop it with systemctl.
1