•For a given address, the network namespace is optional. If given, it must be specified as a / ns  suffix immediately following the address. 

•An address with no / ns  suffix uses the host system global namespace. The global namespace is therefore the default. 

•An address with a / ns  suffix uses the namespace named ns . 

•The host system must support network namespaces and each named namespace must previously have been set up. Naming a nonexistent namespace produces an error. 

• bind_address  and (as of MySQL 8.0.21) mysqlx_bind_address  accept a list of multiple comma- separated addresses, the variable value can specify addresses in the global namespace, in named namespaces, or a mix. 

If an error occurs during server startup for attempts to use a namespace, the server does not start. If errors occur for X Plugin during plugin initialization such that it is unable to bind to any address, the plugin fails its initialization sequence and the server does not load it. 

On the client side, a network namespace can be specified in these contexts: 

•For the mysql  client and the mysqlxtest  test suite client, use the --network-namespace  option. For example: 

mysql --host=192.0.2.2 --network-namespace=red 

If the --network-namespace  option is omitted, the connection uses the default (global) namespace. 

•For replication connections from replica servers to source servers, use the CHANGE REPLICATION SOURCE TO  statement (from MySQL 8.0.23) or CHANGE MASTER TO  statement (before MySQL 8.0.23) and specify the NETWORK_NAMESPACE  option. For example: 

CHANGE REPLICATION SOURCE TO SOURCE_HOST = ’192.0.2.2’, NETWORK_NAMESPACE = ’red’; 

If the NETWORK_NAMESPACE  option is omitted, replication connections use the default (global) namespace. 

The following example sets up a MySQL server that listens for connections in the global, red , and blue namespaces, and shows how to configure accounts that connect from the red  and blue  namespaces. It is assumed that the red  and blue  namespaces have already been created as shown in Host System Prerequisites. 

1. Configure the server to listen on addresses in multiple namespaces. Put these lines in the server my.cnf  file and start the server: 

[mysqld] bind_address = 127.0.1.1,192.0.2.2/red,198.51.100.2/blue 

The value tells the server to listen on the loopback address 127.0.0.1  in the global namespace, the address 192.0.2.2  in the red  namespace, and the address 198.51.100.2  in the blue namespace. 

2. Connect to the server in the global namespace and create accounts that have permission to connect from an address in the address space of each named namespace: 

shell> mysql -u root -h 127.0.0.1 -p Enter password: root_password 

