Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 0a866aa

Browse files
lthHerman Lee
authored andcommitted
Allow mysqladmin to call COM_SHUTDOWN for 5.6 servers
Summary: Because we skipped 5.7, there was no longer any compatibility code that allows clients to call COM_SHUTDOWN for 5.6 servers. Add it back in until we have finished upgrading all servers to 8.0. Differential Revision: D12984296
1 parent 2dba19d commit 0a866aa

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎client/mysqladmin.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ static int execute_commands(MYSQL *mysql, int argc, char **argv) {
718718
!stat(pidfile, &pidfile_status))
719719
last_modified = pidfile_status.st_mtime;
720720

721-
if (mysql_query(mysql, "shutdown")) {
721+
if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT)) {
722722
my_printf_error(0, "shutdown failed; error: '%s'", error_flags,
723723
mysql_error(mysql));
724724
return -1;

‎libmysql/libmysql.cc‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,10 +797,11 @@ MYSQL_RES *STDCALL mysql_list_processes(MYSQL *mysql) {
797797
}
798798

799799
int STDCALL mysql_shutdown(MYSQL *mysql,
800-
enum mysql_enum_shutdown_level shutdown_level
801-
[[maybe_unused]]) {
800+
enum mysql_enum_shutdown_level shutdown_level) {
801+
uchar level[1];
802+
level[0] = (uchar)shutdown_level;
802803
if (mysql_get_server_version(mysql) < 50709)
803-
return simple_command(mysql, COM_DEPRECATED_1, nullptr, 0, 0);
804+
return simple_command(mysql, COM_DEPRECATED_1, level, 1, 0);
804805
else
805806
return mysql_real_query(mysql, STRING_WITH_LEN("shutdown"));
806807
}

0 commit comments

Comments
 (0)