Technology Encyclopedia Home >How to modify the lower_case_table_names parameter of TDSQL-C MySQL version?

How to modify the lower_case_table_names parameter of TDSQL-C MySQL version?

To modify the lower_case_table_names parameter in TDSQL-C MySQL version, you typically need to follow these steps:

  1. Access the Configuration File: Locate the MySQL configuration file, which is usually named my.cnf or my.ini, depending on your operating system.

  2. Edit the Configuration File: Open the configuration file with a text editor and find the [mysqld] section. Add or modify the lower_case_table_names parameter in this section. The parameter can take one of three values:

    • 0: Table names are case-sensitive.
    • 1: Table names are stored in lowercase and comparisons are case-insensitive.
    • 2: Table names are stored as given but comparisons are case-insensitive.

    Example:

    [mysqld]
    lower_case_table_names=1
    
  3. Save and Close: Save the changes to the configuration file and close the text editor.

  4. Restart the Service: Restart the MySQL service to apply the changes. The command to restart the service varies depending on your operating system. For example, on Linux, you might use:

    sudo systemctl restart mysql
    
  5. Verify the Change: Connect to the MySQL server and verify that the parameter has been updated. You can do this by running the following SQL query:

    SHOW VARIABLES LIKE 'lower_case_table_names';
    

Example Scenario:
Suppose you have a MySQL database running on TDSQL-C, and you want to ensure that all table names are treated as case-insensitive. You would follow the steps above, setting lower_case_table_names=1 in the configuration file, restarting the MySQL service, and then verifying the change.

Recommendation for Cloud Users:
If you are using TDSQL-C in a cloud environment, consider leveraging Tencent Cloud's managed database services. Tencent Cloud offers automated management and configuration options that can simplify the process of modifying database parameters like lower_case_table_names. Additionally, Tencent Cloud provides robust monitoring and support to ensure your database runs smoothly.