mysql从Linux转储到Windows

美好的一天堆栈溢出。

我在导入一个SQL文件到我的Windows机器有问题。 该sql文件是从一台Linux机器。 会发生什么是来自Linux的表名是骆驼套,当迁移到Windows,所有变得较低的包装。 我不想调整我的代码,以便能够访问我的数据库,所以是否有我可以在Windows中实现驼峰表名称?

非常感谢。


从linux表名: – > FooBar

当它被导入到Windows的mysql工作台: – > foobar

该查询如下所示:

SELECT * FROM FooBar; // when the program is pointed to the database in windows, it will spit out that the table does not exist because the table name is "foobar" 

Linux和Windows在两个操作系统如何存储表名(只允许小写)之间是有区别的。 这可以由lower_case_table_names系统变量来控制。 您的Windows安装可能已将此值设置为1,并且您的Linux服务器将此值设置为0.继用户手册的“ 标识符区分大小写 ”部分之后,您有两个选项:

在所有系统上使用lower_case_table_names=1 。 这样做的主要缺点是当你使用SHOW TABLESSHOW DATABASES ,你看不到原来的lettercase中的名字。

要么

在Unix上使用lower_case_table_names=0 ,在Windows上使用lower_case_table_names=0 lower_case_table_names=2 。 这保留了数据库和表名的字母大小写。 这样做的缺点是您必须确保您的语句始终在Windows上使用正确的lettercase引用数据库和表名。 如果你把你的语句转移到Unix中,那么lettercase是有意义的,如果这个casecase是不正确的,他们就不会工作。

一些链接:

  • lower_case_table_names系统变量
  • 标识符区分大小写