To modify the My.ini file under the MySQL Tutorial Server installation directory, add the following line to the Mysqld section set-variable=lower_case_table_names=0 (0: Case sensitive 1: Case insensitive) finally restart the MySQL service.
1.lower_case_tables_name=0 situation (Linux default)
Start the MySQL tutorial directly and create a new table in the MyTest library mytable and MyTable
mysql> use mytest;
Mysql> CREATE TABLE mytable (ID int not null,name varchar (a), dt date);
Mysql> CREATE TABLE mytable (ID int not null,name varchar (a), dt date);
Mysql> Show tables;
+------------------+
| Tables_in_mytest |
+------------------+
| MyTable |
| MyTable |
+------------------+
By default, you can create mytable and mytable two tables at the same time
2.lower_case_tables_name=1 situation (we need to set it up in this case)
Enter the ETC directory, edit the my.cnf file
[Root@mysqlserver etc]# VI my.cnf
Find [mysqld]
Add a line to the last side of its global variable: lower_case_table_names = 1
Save, exit, and then restart MySQL
[Root@mysqlserver etc]# service mysqld restart;
Access to MySQL
[Root@mysqlserver mysql]# Bin/mysql
mysql> use mytest;
Mysql> select * FROM MyTable;
Mysql> select * FROM MyTable;
Two query results are the same as the query MyTable table, and the MyTable table has not been found (you can see, but not the query)
Let's try to create a mytable table again.
Mysql> CREATE TABLE mytable (ID int not null,name varchar (a), dt date);
Error 1050 (42S01): Table ' mytable ' already exists
Will get a hint that the table already exists
Again, we can try to create a mytest library
mysql> CREATE DATABASE mytest;
Error 1007 (hy000): Can ' t create database ' mytest '; Database exists
You'll also get hints that the library already exists.
In this case, the table and library names are not case-sensitive.
Note: Before Lower_case_tables_name is set to 1 in Unix, you must first convert the old Database tutorial and table names to lowercase before restarting mysqld, otherwise the previous table will not be found