How to disable MySQL X Protocol (mysqlx_port)

After installing MySQL 8 and checking listening ports with “netstat -lntp”, you will see MySQL is listening on ports 3306 and 33060.

root@mysql:~# netstat -lntp | grep mysql
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      13643/mysqld        
tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      13643/mysqld        
root@mysql:~# 

Port 3306 is used by traditional MySQL protocol (MySQL Classic Protocol). MySQL X Protocol uses port 33060.

What is MySQL X Protocol?

MySQL X Protocol is a network protocol that allows communication between MySQL Server and client applications using a modern, asynchronous, and high-performance approach.

One of the key advantages of MySQL X Protocol is its ability to handle large datasets efficiently, making it ideal for applications that require high-speed data transfer.

It also supports new features in MySQL 5.7 and later versions, such as document store, which allows users to store and retrieve JSON documents directly in the database.

How to disable MySQL X Protocol?

To disable MySQL X protocol, edit MySQL configuration file.

On Ubuntu/Debian

vi /etc/mysql/mysql.conf.d/mysqld.cnf

Find, [mysqld] section, and under it, add

mysqlx=off

Restart MySQL service

systemctl restart mysqld

How to change MySQL X Protocol port?

To change the MySQL X Protocol port, change the following variables in your MySQL configuration file and restart MySQL server.

mysqlx-port=33060
mysqlx-bind-address=127.0.0.1

MySQL X Protocol related variables

To see MySQL 8 related variables, use the SQL command

show variables like 'mysqlx%';

Example

mysql> show variables like 'mysqlx%';
+---------------------------------------------+----------------------------------------+
| Variable_name                               | Value                                  |
+---------------------------------------------+----------------------------------------+
| mysqlx_bind_address                         | 127.0.0.1                              |
| mysqlx_compression_algorithms               | DEFLATE_STREAM,LZ4_MESSAGE,ZSTD_STREAM |
| mysqlx_connect_timeout                      | 30                                     |
| mysqlx_deflate_default_compression_level    | 3                                      |
| mysqlx_deflate_max_client_compression_level | 5                                      |
| mysqlx_document_id_unique_prefix            | 0                                      |
| mysqlx_enable_hello_notice                  | ON                                     |
| mysqlx_idle_worker_thread_timeout           | 60                                     |
| mysqlx_interactive_timeout                  | 28800                                  |
| mysqlx_lz4_default_compression_level        | 2                                      |
| mysqlx_lz4_max_client_compression_level     | 8                                      |
| mysqlx_max_allowed_packet                   | 67108864                               |
| mysqlx_max_connections                      | 100                                    |
| mysqlx_min_worker_threads                   | 2                                      |
| mysqlx_port                                 | 33060                                  |
| mysqlx_port_open_timeout                    | 0                                      |
| mysqlx_read_timeout                         | 30                                     |
| mysqlx_socket                               | /var/run/mysqld/mysqlx.sock            |
| mysqlx_ssl_ca                               |                                        |
| mysqlx_ssl_capath                           |                                        |
| mysqlx_ssl_cert                             |                                        |
| mysqlx_ssl_cipher                           |                                        |
| mysqlx_ssl_crl                              |                                        |
| mysqlx_ssl_crlpath                          |                                        |
| mysqlx_ssl_key                              |                                        |
| mysqlx_wait_timeout                         | 28800                                  |
| mysqlx_write_timeout                        | 60                                     |
| mysqlx_zstd_default_compression_level       | 3                                      |
| mysqlx_zstd_max_client_compression_level    | 11                                     |
+---------------------------------------------+----------------------------------------+
29 rows in set (0.01 sec)

mysql>

Back to MySQL

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *