我要评分
获取效率
正确性
完整性
易理解

Configuring Ports for Multiple Instances in a Single-Node System

MySQL 5.7.27 does not have the mysqlx_port parameter. Therefore, you do not need to add parameters related to mysqlx to the my.cnf configuration file.

When deploying multiple MySQL 8.0.20 instances (for example, three instances) in a single-node system, specify parameters related to mysqlx in the configuration files.

  1. Create data directories.

    For details, see Configuring the Installation Environment and Creating a Data Directory in the MySQL Installation Guide.

    1
    2
    cd /data/mysql
    mkdir data1 data2 data3
    
  2. Modify configuration files.
    1. Specify the IP address and port number of the host in the configuration file of instance 1.
      1. Open the /etc/my.cnf_1 file.
        1
        vim /etc/my.cnf_1
        
      2. Press i to enter the insert mode and configure the file as follows:
        [mysqld_safe]
        log-error=/data/mysql/log/mysql_1.log
        pid-file=/data/mysql/run/mysqld_1.pid
        
        [mysqld]
        report_host=192.168.220.58
        socket=/data/mysql/run/mysql.sock_1
        port=3306
        mysqlx_socket=/data/mysql/run/mysqlx.sock_1
        mysqlx_port=33060
        datadir=/data/mysql/data1
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
    2. Specify the IP address and port number of the host in the configuration file of instance 2.
      1. Open the /etc/my.cnf_2 file.
        vim /etc/my.cnf_2
      2. Press i to enter the insert mode and configure the file as follows:
        [mysqld_safe]
        log-error=/data/mysql/log/mysql_2.log
        pid-file=/data/mysql/run/mysqld_2.pid
        
        [mysqld]
        report_host=192.168.220.58
        socket=/data/mysql/run/mysql.sock_2
        port=3307
        mysqlx_socket=/data/mysql/run/mysqlx.sock_2
        mysqlx_port=33070
        datadir=/data/mysql/data2
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
    3. Specify the IP address and port number of the host in the configuration file of instance 3.
      1. Open the /etc/my.cnf_3 file.
        1
        vim /etc/my.cnf_3
        
      2. Press i to enter the insert mode and configure the file as follows:
        [mysqld_safe]
        log-error=/data/mysql/log/mysql_3.log
        pid-file=/data/mysql/run/mysqld_3.pid
        
        [mysqld]
        report_host=192.168.220.58
        socket=/data/mysql/run/mysql.sock_3
        port=3308
        mysqlx_socket=/data/mysql/run/mysqlx.sock_3
        mysqlx_port=33080
        datadir=/data/mysql/data3
      3. Press Esc, type :wq!, and press Enter to save the file and exit.