I was flipping through O’Reilly’s High Performance MySQL and noticed something handy on page 519 … $dbh->func(‘shutdown’,’admin’);
You can call 4 mysql_* C API functions from within Perl scripts using DBD::mysql, that are also exposed in mysqladmin:
$ perldoc DBD::mysql [...] $rc = $dbh->func('shutdown','admin'); $rc = $dbh->func('reload','admin'); $rc = $dbh->func('createdb',$database,'admin'); $rc = $dbh->func('dropdb',$database,'admin');
So you don’t need to shell out and call mysqladmin to shutdown a MySQL server.
Also nice, it would be trivial to add additional admin functions using the existing framework in DBD::mysql.
One example might be adding the status command, available to mysqladmin and the mysql command line client.