I have done a remote log-in into my Ubuntu 14.04 server as a root user.

When I try:

sudo stop mysql

I get:

stop: unknown instance:

When I try:

sudo service mysql stop

I 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 status

And 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?


Try sudo systemctl status mysqld then, if successful, sudo systemctl stop mysqld.

The name of the service may be different (officially is mysqld).

  • With that I get sudo: systemctl: command not found – CHarris Jun 7 '18 at 21:54
  • Which version of Ubuntu is? Try sudo service mysqld stop. – AndrewQ Jun 7 '18 at 21:55
  • It is Ubuntu 14.04 – CHarris Jun 7 '18 at 22:23

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

  • Thanks but I already tried that one, as indicated in question. With 'service mysql status' I get 'mysql stop/waiting' like it's hanging or something, looks weird to me. – CHarris Jun 7 '18 at 21:17

Here is how I did it eventually.

I looked up the Process ID (PID) for mysqld_safe using:

ps -A

This 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 34678

Then 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
    You're saying that if you stop a service, it restarts itself? What? – Pheric Mar 7 '20 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.