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

Modifying the my.cnf Configuration File of a Specified MySQL Pod

This section uses the mysql-1 configuration file as an example to describe how to modify the configuration file.

  • Method 1: Run the following command on the K8s primary node to access the mysql-1 pod:
    1
    kubectl exec -it mysql-1 -n ns-mysql-test -- /bin/bash
    

    Run the following command in the pod:

    1
    vi /etc/my.cnf
    
  • Method 2: Run the following command on the K8s primary node to open the configuration file on the target pod:
    1
    kubectl exec -it mysql-1 -n ns-mysql-test -- vi /etc/my.cnf
    

    If you use the MobaXterm tool to run the preceding command, the file content may be displayed improperly. You are advised to use PowerShell provided by the Windows operating system.

  • Method 3: Modify the mysql_arm.cnf file on the physical machine where the mysql-1 pod is located.
    1
    vi /data/mysql/mysql_1/mysql_arm.cnf