MySQL’s Missing SHUTDOWN Statement

MySQL LogoDatabases are more easily managed if all operations and logging are available to DBAs and scripts at the SQL client command line.

So an additional improvement to MySQL would be to add a SQL command like Oracle’s SHUTDOWN. This shouldn’t be hard, since there’s existing infrastructure, including the mysqladmin shutdown command and the mysql_shutdown() API, a wrapper around mysql_kill().

Here’s a comparison of Oracle, SQL Server and MySQL.

SHUTDOWN modes and operations Oracle SQL Server MySQL Built-in Closest MySQL Operation
Slow: Disable logins, wait for running processes to finish, flush shutdown shutdown, various external commands NA ask users to logout, wait for all processes to finish, stop slave;, do mysqladmin shutdown
Fast: prevent any new logins, then terminate or rollback any uncommitted transactions, flush shutdown immediate shutdown with nowait NA, my patch mysql_shutdown() API, mysqladmin shutdown or SIGTERM
Crash shutdown abort NA NA SIGKILL (-9)

The existing shutdown_priv should be required to allow a user to perform the SHUTDOWN SQL command.

I discussed this with Monty at the OSCON 2011 MariaDB BOF and SHUTDOWN has been added as WL#232 with a bounty of USD$100.00.

Oracle Concepts – Oracle shutdown commands
Starting, Pausing, and Stopping SQL Server
postgresql manual: Shutting Down the Server, pg_ctl
mysql_shutdown() API
MySQL: The Shutdown Process
MySQL: KILL Syntax

This entry was posted in MySQL, Open Source, Oracle, Tech. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.