top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Stopping mysql does not always stop it?

0 votes
236 views

I am running mysql 5.0 for now, and I have a script that I wrote at 12 am, that stops mysql server, unmounts the disk that has mysql, and takes a different snapshot from amazon as the new disk.

Long story short, 50% of the time the command /etc/init.d/mysqld stop will fail

Stopping MySQL: [FAILED]

Unmounting /opt on dbserver1

I then log on the server and mysql is still running.

When that happens what is the best way to stop mysql? I am trying to write something in my script that will do that, and thinking of using the kill command, but is that the best way?

Or should I be using mysqladmin stop? Is there a better way to bring down mysql server and make sure it is down? Should I be doing something else to ensure it comes down?

posted Jun 6, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The first thing I would do is to check why that 50% of the time the MySQL doesn't get stopped. That's the issue you should start looking at.

Once that problem has been found...you can use either /etc/init.d/mysql stop or mysqladmin. Both should work in the same way. You should never use kill.

In order to check it, you can just try to use pgrep to look for the process and/or also check whether the .pid (and/or .sock) exists. I would always use a combination of two methods to make sure it is stopped.

answer Jun 6, 2013 by anonymous
Similar Questions
+1 vote

I've restored an MySQL backup from our MySQL server into another server. The backup includes InnoDB tables. After the import, MySQL recognized the innodb tables fine but when I try to do a check table it returns that the table doesn't exists.

Permission and owner of the table files (.frm files) are ok, since it recognizes MyISAM tables (they have the same permission). Innodb engine is enabled..

Which can cause the tables to appears as "non existent", as far as they do really exist?

0 votes

We currently have a problem with a master slave setup running mysql 5.0.

This is one of our legacy servers which are in the planning to be upgraded, however in order for this to be done the replication needs to be up and running.

The problem we have currently however is that the binary logs on the master was moved to a seperate partition due to disc space restrictions.

A new binlog file called mysql-bin.1 was created and everything seemed to work fine.

However, the moment the file reached the file size of 100Mb, it does not go on to create a new binlog file called mysql-bin.2 and the replication fails stating that it is unable to read the binary log file.

Thus far we have done a flush logs and reset master , but the same problem occurs, where it creates mysql-bin.1 and the moment it reaches it's max size and suppose to create a new file, it stops and
does not create the new one.

I really hope this makes sense, and that someone can perhaps point us in the correct direction.

+1 vote

Assume there is one database in a system having multiple processes that are accessing this database.
If one process updates database table other processes should be notified. If someone has MySql C APIs document please send me.
Thanks in advance.

0 votes

Is it possible to connect database with c code, if yes then how?

If possible share the sample code for connecting to a MySQL database and run a sample query....

...