Bug #85638 mysql client "status" command reports wrong server version if server upgraded
Submitted: 27 Mar 2017 8:06 Modified: 28 Mar 2017 7:27
Reporter: Riccardo Pizzi Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[27 Mar 2017 8:06] Riccardo Pizzi
Description:
The "status" reported server version is read when mysql client is started and never read again.
So, if you upgrade the server and run "status" again, the stale data is reported.

How to repeat:
- connect to the database using mysql client utility  (command line)
- run "status" command, note reported server version
- stop MySQL server and upgrade (or downgrade) to another release
- start MySQL server
- run "status" comand in the client again, old server version will be reported

Suggested fix:
refresh data each time  "status" command is issued instead that doing it only at startup
[28 Mar 2017 7:15] MySQL Verification Team
Hello Riccardo Pizzi,

Thank you for the report.
Could you please confirm the exact MySQL Server version, package and OS details on which this reported issue observed? I have tried with 5.6.34->5.6.35 in place upgrade but have not observed the reported issue.

Thanks,
Umesh

==========
rm -rf 85638
scripts/mysql_install_db --basedir=$PWD --datadir=$PWD/85638 -v
bin/mysqld --no-defaults --basedir=$PWD --datadir=$PWD/85638 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=$PWD/85638/log.err  2>&1 &

[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.34: bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> status;
--------------
bin/mysql  Ver 14.14 Distrib 5.6.34, for linux-glibc2.5 (x86_64) using  EditLine wrapper

Connection id:          2
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.34-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql_ushastry.sock
Uptime:                 25 sec

Threads: 1  Questions: 7  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.280
--------------

-- Upgrade to 5.6.35

bin/mysqld --no-defaults --basedir=$PWD --datadir=/export/umesh/server/binaries/GABuilds/mysql-5.6.34/85638 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=/export/umesh/server/binaries/GABuilds/mysql-5.6.34/85638/log.err  2>&1 &

root@localhost [(none)]> \q
Bye
[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.34: bin/mysqladmin -uroot -S /tmp/mysql_ushastry.sock shutdown
[1]+  Done                    bin/mysqld --no-defaults --basedir=$PWD --datadir=$PWD/85638 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=$PWD/85638/log.err 2>&1
[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.34: cd ../mysql-5.6.35
[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.35: bin/mysqld --no-defaults --basedir=$PWD --datadir=/export/umesh/server/binaries/GABuilds/mysql-5.6.34/85638 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=/export/umesh/server/binaries/GABuilds/mysql-5.6.34/85638/log.err  2>&1 &
[1] 2481
[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.35: 2017-03-28 09:11:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-28 09:11:19 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-03-28 09:11:19 0 [Note] bin/mysqld (mysqld 5.6.35-enterprise-commercial-advanced) starting as process 2481 ...

[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.35: bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.35-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> status;
--------------
bin/mysql  Ver 14.14 Distrib 5.6.35, for linux-glibc2.5 (x86_64) using  EditLine wrapper

Connection id:          1
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.35-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql_ushastry.sock
Uptime:                 6 sec

Threads: 1  Questions: 6  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 1.000
[28 Mar 2017 7:20] Riccardo Pizzi
Your test is not correct. 
You should leave the mysql client open in another window while you upgrade.
Of course, if you exit the client and launch it again after the upgrade it will work just fine.
[28 Mar 2017 7:27] MySQL Verification Team
Thank you for the feedback!

==
[umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.34: bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> status;
--------------
bin/mysql  Ver 14.14 Distrib 5.6.34, for linux-glibc2.5 (x86_64) using  EditLine wrapper

Connection id:          2
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.34-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql_ushastry.sock
Uptime:                 41 sec

Threads: 1  Questions: 8  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.195
--------------

root@localhost [(none)]> -- upgrade from 5.6.34 to 5.6.35
root@localhost [(none)]> status;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: *** NONE ***

--------------
bin/mysql  Ver 14.14 Distrib 5.6.34, for linux-glibc2.5 (x86_64) using  EditLine wrapper

Connection id:          1
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.34-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql_ushastry.sock
Uptime:                 20 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.200