I have an export from a MYSQL database on a linux machine however when importing that database into MYSQL on windows all of the table names that were camel cased are now all lower case. The sql dump has the correct case in it but the importing via phpmyadmin seams to remove these.
How can I import it and keep the case?
For windows, it's available in the C:\ProgramData\MySQL\MySQL Server X.X directory. Open this file in administrator mode and set the lower_case_table_names variable value to 2. These changes will not take effect until you restart the MySQL server before restarting the MySQL Server by following steps.
By default, it depends on the operating system and its case sensitivity. This means MySQL is case-insensitive in Windows and macOS, while it is case-sensitive in most Linux systems. However, you can change the behavior by changing collation.
To set the collation for the entire database, you can use: CREATE DATABASE test_database CHARACTER SET utf8 COLLATE utf8_general_cs; You can also change the collation on an existing database via ALTER DATABASE. (For more information see the MySQL Database Character Set and Collation manual entry.)
The Windows file system supports setting case sensitivity with attribute flags per directory. While the standard behavior is to be case-insensitive, you can assign an attribute flag to make a directory case sensitive, so that it will recognize Linux files and folders that may differ only by case.
There is a setting for mysql to allow case differentiation in windows. You need to edit the my.cnf
file and alter the setting:
lower_case_table_names=2
Then restart mysql.
Otherwise, this may be a case of phpmyadmin changing case in the way it passes queries to the server rather than a linux-to-windows problem. Have you tried importing the sql dump using another mysql manager such as SQLyog? (Tools -> Restore from SQL Dump...)
It is probably worth reading the following page from the MySQL Reference Manual: http://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html
Based on that, I think you need to set to 0, not 2, which will ensure that the schema is stored using the same case as defined in your DDL.
lower_case_table_names=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With