Mysql table name not uppercase

I need to modify mysql to accept the name in both upper and lower case,

select * from users

the request above works fine, but the request below doesn't work,

select * from USERS 
+4
source share
4 answers

It depends on your system (Unix, Windows, and Mac OS for basic values).

You need to set the system variable "lower_case_table_names" to 1 or 2 to make the database case insensitive.

SET lower_case_table_names=1;

or

SET lower_case_table_names=2;

click Mysql.com and here

+6
source

, , CREATE TABLE CREATE DATABASE. . 0, MySQL (, Windows Mac OS X). 0 - lower-case-tables-names = 0 MyISAM , .

http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

0

Windows Unix.

In MySQL, databases correspond to directories within the data directory. 
Each table within a database corresponds to at least one file within the database
directory. Consequently, the case sensitivity of the underlying operating system 
plays a part in the case sensitivity of database and table names.

: 8.2.2.

But to solve your problem, you can create a table view in which the name will be designated as another case. But then what happens tousers

0
source

One option may include all lower or upper table names according to the needs of your OS.

select concat('rename table ', table_name, ' to ' , lower(table_name) , ';') from information_schema.tables where table_schema = 'your_schema_name';

copy all the lines and execute them :)

0
source

All Articles