Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off case sensitivity for entire database

Tags:

mysql

mariadb

I have created a database that has many scripts and many sprocs, in this db we have not paid attention to worrying about case sensitivity as it was off for my local development machine.

With all of this said, I am trying to figure out how to make the following 2 statements return the same result.

SELECT * FROM companies
SELECT * FROM Companies

Currently the lowercase one doesn't return anything and says that there isn't that table in the schema.

like image 541
3xGuy Avatar asked Oct 22 '25 10:10

3xGuy


1 Answers

There is a variable called lower_case_table_names in my.cnf file which can be set as lower_case_table_names=1 to make the mysql table incasesensitive.

To do this in Linux below are the steps:

Open terminal and edit /etc/mysql/my.cnf

sudo nano /etc/mysql/my.cnf Underneath the [mysqld] section.add if not present in the cnf file:

lower_case_table_names = 1

Restart mysql

sudo /etc/init.d/mysql restart

like image 129
Abhay Avatar answered Oct 25 '25 14:10

Abhay



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!