Bug #77984 mysqladmin shutdown fails for 5.7.0 .. 5.7.8
Submitted: 7 Aug 2015 15:12 Modified: 12 Aug 2015 14:06
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[7 Aug 2015 15:12] Paul DuBois
Description:
With the implementation in 5.7.9 of the SHUTDOWN statement, "mysqladmin shutdown" switche from COM_SHUTDOWN protocol command to SHUTDOWN statement for newer servers. But the version test causes failure for earlier 5.7.x versions.

How to repeat:
Use mysqladmin shutdown against a server from 5.7.0 to 5.7.8.
Result:

mysqladmin: shutdown failed; error: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'shutdown' at line 1'

Suggested fix:
The source says:

      /* Issue COM_SHUTDOWN if server version is older then 5.7*/
      int resShutdown= 1;
      if(mysql_get_server_version(mysql) < 50700)
        resShutdown= mysql_shutdown(mysql, SHUTDOWN_DEFAULT);
      else
        resShutdown= mysql_query(mysql, "shutdown");

Change the test from 50700 to 50709.
[7 Aug 2015 17:21] MySQL Verification Team
Shutdown on Win64

Attachment: mysqladmin-5-7-9.png (image/png, text), 54.92 KiB.

[7 Aug 2015 17:23] MySQL Verification Team
I couldn't repeat on Windows 64-bit with source some weeks ago (will test with latest one however later). Which OS you used to test?. Thanks.
[8 Aug 2015 12:18] Paul DuBois
I found the same result on OS X and Linux.
[9 Aug 2015 0:21] MySQL Verification Team
Thank you for the feedback.

C:\dbs>5.7\bin\mysqladmin --version
5.7\bin\mysqladmin  Ver 8.42 Distrib 5.7.9, for Win64 on x86_64

C:\dbs>5.7\bin\mysqladmin -uroot -p shutdown
Enter password: ******
mysqladmin: shutdown failed; error: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'shutdown' at line 1'
[12 Aug 2015 14:06] Paul DuBois
Bug affects no release version. No changelog entry needed.