Experiment:
1.lower_case_tables_name=0 situation (Linux default) Start MySQL directly, 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, the old database name and table name must be converted to lowercase before restarting mysqld, otherwise the previous table will not be found.
(In the previous experiment, the MyTable table was not found in lower_case_tables_name=1)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.