Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql changed lower_case_table_names now i can't select tables

Tags:

mysql

I did this in order to be able to create tables upper cased, now when i try to change, select or do anything with the upper cased classes i have an error because it looks for a lower cased version of it

SELECT cust_id FROM Customer LIMIT 0, 1000
Error Code: 1146. Table 'toys.customer' doesn't exist

I am using schema "toys" and it has a Customer table i properly created

like image 230
user6008337 Avatar asked Dec 31 '25 06:12

user6008337


1 Answers

In my.cnf do lower_case_table_names=2 , to use upper cases

From Mysql manual, about lower_case_table_names values:

0 Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement. Name comparisons are case sensitive. You should not set this variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or OS X). If you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive file system and access MyISAM tablenames using different lettercases, index corruption may result.

1 Table names are stored in lowercase on disk and name comparisons are not case sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases.

2 Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This works only on file systems that are not case sensitive! InnoDB table names are stored in lowercase, as for lower_case_table_names=1.

On Unix, the default value of lower_case_table_names is 0. On Windows, the default value is 1. On OS X, the default value is 2.

After editing my.cnf values don't forget to restart MySQL.

like image 124
Muhammed Avatar answered Jan 01 '26 22:01

Muhammed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!