Enforcing Case Sensitivity for Table Names in MySQL
In a specific MySQL database on Windows, case-sensitive table names are essential for migration to a Linux environment. However, upon backing up the database, all table names are coerced to lowercase, causing duplication errors during restoration in Linux. Despite the inability to alter MySQL settings in the Linux environment, is there a solution to enforce case sensitivity for table names in MySQL (v5.x) on Windows?
Answer:
To address this issue, delve into the MySQL documentation for "Identifier Case Sensitivity." Specifically, add the "lower_case_table_names" system variable with a value of 2 to the [mysqld] section of the my.ini configuration file.
Code:
<code class="ini">[mysqld] lower_case_table_names=2</code>
Implementation:
Once this system variable is set, restart the MySQL service to apply the change. This should ensure that table names preserve their case sensitivity during the backup process and subsequent restoration in the Linux environment.
The above is the detailed content of How to Enforce Case Sensitivity for Table Names in MySQL on Windows for Linux Migration?. For more information, please follow other related articles on the PHP Chinese website!