MySQL Shell 8.0  /  ...  /  Compression Control For MySQL Shell 8.0.14 Through 8.0.19

4.3.7.2 Compression Control For MySQL Shell 8.0.14 Through 8.0.19

In releases from MySQL Shell 8.0.14 through 8.0.19, compression can be requested only for connections that use classic MySQL protocol. The default is that compression is not requested. Compression in these releases uses the zlib compression algorithm. You cannot require compression in these releases, so if compression is not supported by the server, the session falls back to an uncompressed connection.

In these MySQL Shell releases, compression control is limited to enabling (by specifying true) or disabling (by specifying false) compression for a connection. If you use a MySQL Shell release with this compression control to connect to a server instance at MySQL 8.0.18 or later, where client requests for compression algorithms are supported, enabling compression is equivalent to proposing the algorithm set zlib,uncompressed.

MySQL Shell cannot request compression in releases before 8.0.14.

To request compression for a connection in MySQL Shell 8.0.14 through 8.0.19, use one of the following methods:

  • If you are starting MySQL Shell from the command line and specifying connection parameters using separate command options, use the --compress (-C) option, for example:

    $> mysqlsh --mysql -u user -h localhost -C
  • If you are using a URI-like connection string to specify connection parameters, either from the command line, or with MySQL Shell's \connect command, or with the shell.connect() method, use the compression=true parameter in the query string:

    mysql-js> \connect user@example.com?compression=true
    $> mysqlsh mysql://user@localhost:3306?compression=true
  • If you are using key-value pairs to specify connection parameters, either with MySQL Shell's \connect command or with the mysql.getClassicSession() method, use the compression parameter in the dictionary of options:

    mysql-js> var s1=mysql.getClassicSession({host: 'localhost',
                                              user: 'root',
                                              password: 'password',
                                              compression: 'true'});