1

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.

muru
  • 197,895
  • 55
  • 485
  • 740
  • 1
    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 03:01

5 Answers5

5

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

service mysql stop

or

/etc/init.d/mysql stop

Because of your installation, you should try this:

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

Frantique
  • 8,493
  • 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 "http://dev.mysql.com/doc/refman/5.5/en//binary-installation.html" 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
  • i did that and continuously getting following errors : InnoDB: using the same InnoDB data or log files. InnoDB: Unable to lock ./ibdata1, error: 11
    i am really sorry but i am helpless
    – Mangesh Jogade Nov 28 '12 at 15:12
  • 1
    Forget about binary installation, remove it, and install mysql server with sudo apt-get install mysql-server – Frantique Nov 28 '12 at 15:21
2

Use sudo mysqld stop to stop it as root.

hope it helped.

denNorske
  • 975
  • 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
  • sorry, but i dont have any idea how to do that if that above didnt work. Yeah, sorta bug if you ask me. – denNorske Nov 28 '12 at 14:04