Novell is now a part of Micro Focus

Auto-Shutdown of MySQL

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 2 Jun 2005

A reader asked:

"I want to automate a shutdown of MySQL every night for backup. I've created an extra MySQL account with no password but with the privilege to be able to shut down the database. Using the command "mysqladmin -u myaccount shutdown" works, but it presents a screen saying "NLM has terminated - please press a key". At this point, mysqld_safe.nlm and mysqld.nlm (the main MySQL nlm's as I understand it) are still loaded and don't unload until a key is pressed.

So is it possible to have a cronned command that automatically unloads the database?" And here are the responses from Forum experts:

Expert 1: If you start mysqld_safe with an --autoclose option, you won't get the screen waiting for user interaction. In the autoexec.ncf file (or wherever you start mysql), use this:

MYSQLD_SAFE --autoclose

Your cron job will then shut it down just fine.

Expert 2: There is a Perl script that will allow you to take a snapshot while the database is running. You can then backup the snapshot. Taking the snapshot is as easy as copying it back to the orginal directory for a restore. It works very well. The script is called mysqlhotcopoy - here's the information on it:

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates