问题
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?
回答1:
Read all this: http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html
Then add this system variable to the server section, [mysqld], of my.ini and restart mysql:
/my.ini: lower_case_table_names=2
回答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.
回答3:
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.
回答4:
On windows put lower_case_table_names=2 at the end of file C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
回答5:
i add this line and it solve the different case problem
lower_case_table_names=1
in /etc/my.cnf
you can see how to set mysql variable "lower_case_table_names" form this page : https://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_lower_case_table_names
回答6:
Add this property to lower_case_table_names=2 to my.ini
来源:https://stackoverflow.com/questions/6248735/how-to-force-case-sensitive-table-names