Bug #119677 Session Tracking example doesn't work
Submitted: 14 Jan 9:08
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.4, 9.5 OS:Any
Assigned to: CPU Architecture:Any

[14 Jan 9:08] Daniël van Eeden
Description:
Page: https://dev.mysql.com/doc/refman/9.5/en/server-system-variables.html#sysvar_session_track_...

The example:
====================================================================
mysql>  SET @@SESSION.session_track_system_variables='statement_id'
mysql>  SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.0006 sec)
Statement ID: 603835
====================================================================

Issues
1. There is a missing `;` at the end of the `SET` statement.
2. With MySQL 9.5 client and server I don't get the `Statement ID:` line.

How to repeat:
mysql-9.5.0 [(none)]> SET @@SESSION.session_track_system_variables='statement_id';
Query OK, 0 rows affected (0.001 sec)

mysql-9.5.0 [(none)]> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.000 sec)

mysql-9.5.0 [(none)]> 

Wireshark does show the `statement_id` being sent by the server:

Session tracking data
    Session tracking data length: 18
    Session Track
        Session tracking type: SESSION_SYSVARS_TRACKER (0)
        Session tracking length: 16
        System variable change Length: 12
        System variable change Name: statement_id
        System variable change Length: 2
        System variable change Value: 37

Note that MySQL Shell does show this information:
sql> SET @@SESSION.session_track_system_variables='statement_id';
Query OK, 0 rows affected (0.0005 sec)

sql> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.0006 sec)
Statement ID: 56

sql> 

Suggested fix:
1. Add the same functionality to MySQL Client
2. Explicitly state that this example requires MySQL Shell. Either explicitly in the description or implicitly by using a recognizable prompt like `mysqlsh> `