How do you normally shutdown a MariaDB 5.5 or MySQL server?
mysqladmin shutdown -uroot -p
But MariaDB 10 (beta quality, at the time of this writing) has a quick way to do the same:
C:\Documents and Settings\utente1>mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.0.4-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> SELECT 'I\'m alive!'; +------------+ | I'm alive! | +------------+ | I'm alive! | +------------+ 1 row in set (0.00 sec) MariaDB [(none)]> SHUTDOWN; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> SELECT 'I\'m gone away'; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061 "Unknown error") ERROR: Can't connect to the server unknown [(none)]> \q Bye
SHUTDOWN works in stored programs. This allows to write an event which turns the server off everyday at a certain time, or when a task is finished. This is safer than a cron job which kills it, and works on any system.
DELIMITER || CREATE EVENT `test`.`shutd` ON SCHEDULE EVERY 1 DAY STARTS '2014-01-01 20:00:00' COMMENT 'Shutdown Maria when the office closes' DO BEGIN SHUTDOWN; END; || DELIMITER ;