Stops the MariaDB server process. Allows a client with the SHUTDOWN privilege to cleanly power down the database instance.
The SHUTDOWN command shuts the server down.
The WAIT FOR ALL REPLICAS statement can be used throughout.
The WAIT FOR ALL SLAVES option was first added in .
When a primary server is shutdown and it goes through the normal shutdown process, the primary kills client threads in random order. By default, the primary also considers its binary log dump threads to be regular client threads. As a consequence, the binary log dump threads can be killed while client threads still exist, and this means that data can be written on the primary during a normal shutdown that won't be replicated. This is true even if is being used.
This problem can be solved by shutting down the server with the command and by providing the WAIT FOR ALL REPLICAS/WAIT FOR ALL SLAVES option to the command. For example:
When the WAIT FOR ALL REPLICAS option is provided, the server only kills its binary log dump threads after all client threads have been killed, and it only completes the shutdown after the last has been sent to all connected replicas.
See for more information.
One must have a SHUTDOWN privilege (see ) to use this command. It is the same privilege one needs to use the command.
If you are doing a shutdown to , please ensure that the variable is not 2 (fast crash shutdown). The default of this variable is 1.
The following example shows how to create an which turns off the server at a certain time:
You can use the command to take down mariadbd cleanly.
You can also use the system kill command on Unix with signal SIGTERM (15)
You can find the process number of the server process in the file that ends with .pid in your data directory.
The above is identical to mariadb-admin shutdown.
On windows you should use:
.
This page is licensed: CC BY-SA / Gnu FDL
SHUTDOWN [WAIT FOR ALL { SLAVES | REPLICAS } ]SHUTDOWN WAIT FOR ALL REPLICAS;CREATE EVENT `test`.`shutd`
ON SCHEDULE
EVERY 1 DAY
STARTS '2014-01-01 20:00:00'
COMMENT 'Shutdown Maria when the office is closed'
DO BEGIN
SHUTDOWN;
END;kill -SIGTERM pid-of-mariadbd-processNET STOP MariaDB