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
  • 193,181
  • 53
  • 473
  • 722
Mangesh Jogade
  • 743
  • 2
  • 6
  • 8
  • 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
  • possible duplicate of [How do I start/stop mysql server?](http://askubuntu.com/questions/82374/how-do-i-start-stop-mysql-server) – Lucio Oct 28 '14 at 00:40

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,435
  • 35
  • 51
  • 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
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/6537/discussion-between-mangesh-jogade-and-frantique) – Mangesh Jogade Nov 28 '12 at 15:27
2

Use sudo mysqld stop to stop it as root.

hope it helped.

denNorske
  • 965
  • 8
  • 31
2
sudo /etc/init.d/mysqld stop

should do it.

GaryBishop
  • 894
  • 6
  • 10
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.

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.

thomasrutter
  • 36,068
  • 10
  • 86
  • 105
-2

try the following:

quit;

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!