MariaDB and MySQL table name is case sensitive if running on case-sensitive systems such as Linux and Unix. Windows, however, does not enforce case sensitivity for its folders and files. It is causing MySQL and MariaDB table names in Windows to be case-insensitive.
It means that a lowercase table named tablename is just the same as uppercase TABLENAME or TableName, and using any of these will not make any difference in your query. It is because MySQL and MariaDB store and query database tables based on the filesystem's filename and folder.
You can use case-insensitive table names for MySQL and MariaDB in Linux and other Unix systems or use case sensitive table names in Windows by enabling lower_case_table_names option in the configuration file.
$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
lower_case_table_names=1
Add the line if it doesn't already exist. Set the value to the followings as per your requirement.
Value | Description |
---|---|
0 | Stored based on CREATE statement and case sensitive |
1 | Stored in lowercase and not case sensitive |
2 | Stored based on CREATE statement and not case sensitive |
$ sudo mysqladmin -u root -p variables | grep lower_case_table_names Enter password: | lower_case_table_names | 1
Comment anonymously. Login not required.