MySQL setting under Linux system is case insensitive
lower_case_table_names
Parameter details:
lower_case_table_names=1where 0: case sensitive, 1: case insensitive
Query the current settings:
mysql> show variables
like
'%lower%'
;
+
------------------------+-------+
| Variable_name | Value |
+
------------------------+-------+
| lower_case_file_system |
OFF
|
| lower_case_table_names | 1 |
+
------------------------+-------+
2
rows
in
set
(0.01 sec)
lower_case_file_system
indicates whether the current system file is case-sensitive, a read-only parameter, and cannot be modified .
ON case-insensitive
OFF case-sensitive
lower_case_table_names
indicates whether the table name is case-sensitive and can be modified .
When lower_case_table_names = 0, mysql will operate directly according to the table name, which is case-sensitive.
When lower_case_table_names = 1, mysql will convert the table name to lowercase before performing the operation.
Most solutions online are:
1. Log in with root privileges and modify the configuration file /etc/my.cnf
2. Under the [mysqld] node, add a line: lower_case_table_names=1
3. Restart MySQL: service mysqld.server restart
Under some versions of MySQL, if there is an uppercase table before, after modifying the parameters, the table will prompt that it does not exist, and it cannot be modified, so the application cannot operate.
Analysis of the problem:
If a large number of tables and data have been imported in the case of lower_case_table_names=0, and the table names are uppercase and lowercase, then changing to lower_case_table_names=1 will cause an error.
Solution: When lower_case_table_names=0, change all table names to lowercase; if there are uppercase letters in the database name, you need to change the name at the same time. The method of changing the name is to create a lowercase database, and then change the table name. (The most convenient is to directly use the MySQL interface client to modify)
After all the names have been renamed, set lower_case_table_names=1 and restart MySQL.
Query confirmation after the change:
mysql> show variables
like
'%lower%'
;
+
------------------------+-------+
| Variable_name | Value |
+
------------------------+-------+
| lower_case_file_system |
ON
|
| lower_case_table_names | 0 |
+
------------------------+-------+