Connection Compression Control This assumes that the  slave_compressed_protocol  system variable is disabled, for reasons described in Configuring Legacy Connection Compression. For successful connection setup, both sides of the connection must agree on a mutually permitted compression algorithm. The algorithm-negotiation process attempts to use  zlib , then  zstd , then uncompressed . If the two sides can find no common algorithm, the connection attempt fails. Because both sides must agree on the compression algorithm, and because  uncompressed  is an algorithm value that is not necessarily permitted, fallback to an uncompressed connection does not necessarily occur. For example, if the server is configured to permit  zstd  and a client is configured to permit  zlib,uncompressed , the client cannot connect at all. In this case, no algorithm is common to both sides, so connection attempts fail. Configuration parameters that enable specifying the  zstd  compression level take an integer value from 1 to 22, with larger values indicating increasing levels of compression. The default  zstd  compression level is 3. The compression level setting has no effect on connections that do not use  zstd  compression. A configurable  zstd  compression level enables choosing between less network traffic and higher CPU load versus more network traffic and lower CPU load. Higher compression levels reduce network congestion but the additional CPU load may reduce server performance. Prior to MySQL 8.0.18, these configuration parameters are available for controlling connection compression: In each case, when use of compression is specified, the connection uses the  zlib  compression algorithm if both sides permit it, with fallback to an uncompressed connection otherwise. As of MySQL 8.0.18, the compression parameters just described become legacy parameters, due to the additional compression parameters introduced for more control over connection compression that are described in Configuring Connection Compression. An exception is MySQL Shell, where the  -- compress  command-line option remains current, and can be used to request compression without selecting compression algorithms. For information on MySQL Shell’s connection compression control, see Using Compressed Connections. 379 Configuring Legacy Connection Compression •Client programs support a  --compress  command-line option to specify use of compression for the connection to the server. •For programs that use the MySQL C API, enabling the  MYSQL_OPT_COMPRESS  option for the mysql_options()  function specifies use of compression for the connection to the server. •For source/replica replication, enabling the  slave_compressed_protocol  system variable specifies use of compression for replica connections to the source. •To configure replicas to connect to the source using  zlib  or  zstd  connections, with a compression level of 7 for  zstd  connections, use a  CHANGE REPLICATION SOURCE TO  statement (from MySQL 8.0.23) or  CHANGE MASTER TO  statement (before MySQL 8.0.23): •To permit the  mysql  client to initiate  zlib  or  uncompressed  connections, invoke it like this: SET PERSIST protocol_compression_algorithms=’zstd’; mysql --compression-algorithms=zlib,uncompressed CHANGE REPLICATION SOURCE TO SOURCE_COMPRESSION_ALGORITHMS = ’zlib,zstd’, SOURCE_ZSTD_COMPRESSION_LEVEL = 7;