Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can i stop mysql server (installed using binary installation under /usr/local/mysql)?

When i go in /usr/local/mysql/bin and execute command

mysqld stop i get following error message :

[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
[ERROR] Aborting
[Note] mysqld: Shutdown complete

and i can still see process for mysql server.

same happens when i try to do it with mysqld in /etc/init.d.

share|improve this question
You have elected not to install the mysql package provided by Ubuntu and have instead manually installed a version into /usr/local - as such you are not doing things the normal "Ubuntu" way and the advice you get here may be affected. That said, I'm sure people will still try and help as best they can. But as a point of clarification - you should always use the Ubuntu-packaged versions of software unless you have a specific reason not to, and in that case you should mention that reason in your question. – thomasrutter Apr 15 '14 at 3:01
possible duplicate of How do I start/stop mysql server? – Lucio Oct 28 '14 at 0:40
up vote 3 down vote accepted

Assuming that you are running an up-to-date Ubuntu and you are already root, as you mentioned, the command is:

service mysql stop


/etc/init.d/mysql stop

Because of your installation, you should try this:

sudo -u mysql /usr/local/mysql/bin/mysqld stop

share|improve this answer
for service mysql stop : it gives following output - > mysql: unrecognized service and for mysql stop : it gives following output - > ERROR 1049 (42000): Unknown database 'stop' – Mangesh Jogade Nov 28 '12 at 14:41
Please specify how did you installed your mysql server, also why you don't use the package version. We cannot really help you like this. Beside this you should run mysql server under mysql user and not as root. This is why it throws you errors. – Frantique Nov 28 '12 at 14:45
i have installed using binary package as described in ""; and i am running it under mysql usr "/bin/sh bin/mysqld_safe --user=mysql" – Mangesh Jogade Nov 28 '12 at 14:54
See my edited answer. – Frantique Nov 28 '12 at 15:00
Forget about binary installation, remove it, and install mysql server with sudo apt-get install mysql-server – Frantique Nov 28 '12 at 15:21

Use sudo mysqld stop to stop it as root.

hope it helped.

share|improve this answer
error occurred when i executed with root. – Mangesh Jogade Nov 28 '12 at 13:27
Then, are you sure you are in the sudo'ers file? That you are allowed to use "sudo" ? Find the process and kill it with pkill, find it by reading the list on ps -e. – denNorske Nov 28 '12 at 13:34
1) i was looged in as root 2) i can kill the process, but why i am not able to stop it with mysqld ? is it any bug??? – Mangesh Jogade Nov 28 '12 at 13:38
mysqld is the file that runs, you can end the file, but the process will remain running in the background. So you just have to kill the process manually. – denNorske Nov 28 '12 at 13:43
i want to stop it using mysqld only. – Mangesh Jogade Nov 28 '12 at 13:47
sudo /etc/init.d/mysqld stop

should do it.

share|improve this answer
i am already a root – Mangesh Jogade Nov 28 '12 at 13:28

You have elected not to install the mysql package provided by Ubuntu and have instead manually installed a version into /usr/local - as such you are not doing things the normal "Ubuntu" way and the advice you get here may be affected.

The normal way of install MySQL in Ubuntu is by installing the package provided by Ubuntu using something like sudo apt-get install mysql-server. Installing something manually into /usr/local with a make or install script should be something done only when you have a specific reason to do so and you have a greater level of technical skill and knowledge, and willingness to set it up correctly yourself. You'll also need to do updates and security patches manually because it won't be done by Ubuntu.

Based on your level of technical knowledge of Ubuntu I don't think installing something manually into /usr/local is for you. Unless you respond with a good reason for not being able to use the one included with Ubuntu and you really want to learn more, I'd advise removing that MySQL and installing the Ubuntu one with sudo apt-get install mysql-server.

After doing this, you'll be able to follow all the normal instructions you find on the Ubuntu wikis and howtos.

share|improve this answer

try the following:


this worked for me...then i just got the msg: "bye". then it was showing again to enter a comand as the USER@user>, not as MYSQL>. Help this works!

share|improve this answer
This shows how to quit the command line client but the question is about how to stop the server. – Florian Diesch Apr 15 '14 at 3:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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