mysql> show variables like 'lower_case_table_names';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_table_names | 0 |
+------------------------+-------+
1 row in set (0.01 sec)
mysql> set global lower_case_table_names=1;
ERROR 1238 (HY000): Variable 'lower_case_table_names' is a read only variable
mysql> set lower_case_table_names=1;
ERROR 1238 (HY000): Variable 'lower_case_table_names' is a read only variable
mysql>
默认是0,代表区分大小写,改为1,为不区分大小写。此参数不支持动态修改,需要在my.cnf里增加lower_case_table_names=1,然后重启MYSQL数据库即可。
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| car |
| test1 |
| test2 |
| user |
| user_201112 |
| user_201201 |
| user_201202 |
| user_201203 |
+----------------+
8 rows in set (0.00 sec)
mysql> select * from TEST2;
+----+------+------+
| id | tid | name |
+----+------+------+
| 2 | 2 | bb |
| 3 | 3 | cc |
| 4 | 4 | NULL |
| 6 | 4 | ee |
+----+------+------+
4 rows in set (0.04 sec)
mysql> select * from test2;
+----+------+------+
| id | tid | name |
+----+------+------+
| 2 | 2 | bb |
| 3 | 3 | cc |
| 4 | 4 | NULL |
| 6 | 4 | ee |
+----+------+------+
4 rows in set (0.00 sec)
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/842969