How to force case sensitive table names?
I'm working on a MySQL database in windows.
I must move it into a Linux environment. MySQL database contains a lot of tables and stored procedures which are CASE SENSITIVE.
When I backup my database, all table names are forced lowercase so when I restore it in Linux it complains because you can't make duplicate tables and stored procedures.
I don't have access to the MySQL configuration in the linux environment so I cant change MySQL settings to case insensitive mode.
Is there any way to force MySQL (v5.x) to use case sensitive table names in windows?
Read the following chapter in the official MySQL documentation: Identifier Case Sensitivity.
Then add the following system variable to the server section, [mysqld]
, inside the my.ini
configuration file and restart the MySQL service:
lower_case_table_names=2
Have a look at this article - http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
Mode 2 allows to store tables with specified lettercase, but anyway, name comparisons won't be case sensitive and you won't be able to store table1
and Table1
at the same time.
On Windows put lower_case_table_names=2
at the end of theC:\ProgramData\MySQL\MySQL Server 5.7\my.ini
file.
Unfortunately there's no way of making MySQL on windows to behave 100% as in Linux. What you can do, is to run a minimal VM on Virtual Box or VMware player with TurnKey - MySQL Appliance.
In my personal experience, I've found quite useful to have a VM with a configuration similar to the deployment environment to diagnose problems.