mysql从linux转储到Windows [英] mysql dump from linux to windows
问题描述
美好的一天堆栈溢出.
我在将sql文件导入Windows机器时遇到问题. sql文件来自linux计算机.发生的情况是,Linux中的表名使用驼峰式大小写,并且在迁移到Windows时,所有表名都使用小写形式.我不想调整我的代码以能够访问我的数据库,因此无论如何,我可以在Windows中获得驼峰式表名吗?
I am having problems on importing an sql file to my windows machine. The sql file is from a linux machine. What happens is that the table names from linux are camel cased and when migrated to windows, all becomes lower cased. I don't want to adjust my codes to be able to access my database so is there anyway that I could achieve the camel-cased table names in windows?
非常感谢.
从linux表名称开始: -> FooBar
From linux table names: -> FooBar
在Windows中将其导入到mysql工作台时: -> foobar
When it is imported to mysql workbench in windows: -> 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.在"
There is a difference between Linux and Windows on how both operating systems store the table names (allowing lower case only or not). This can be controlled by the lower_case_table_names
system variable. Your Windows installation, probably has this value set to 1 and your Linux server had this value set as 0. Following the "Identifier Case Sensitivity" part of the User Manual, you have two options:
在所有系统上使用
lower_case_table_names=1
.主要缺点 这是因为当您使用SHOW TABLES
或SHOW DATABASES
时,您会 没有看到其原始字母大写的名称.
Use
lower_case_table_names=1
on all systems. The main disadvantage with this is that when you useSHOW TABLES
orSHOW DATABASES
, you do not see the names in their original lettercase.
或
在Unix上使用
lower_case_table_names=0
,在Unix上使用lower_case_table_names=2
视窗.这将保留数据库和表名的字母大小写. 这样做的缺点是您必须确保您的陈述 始终使用正确的名称引用数据库和表名称 Windows上的大写字母.如果将语句转移到Unix, 字母是重要的,如果字母是 不正确.
Use
lower_case_table_names=0
on Unix andlower_case_table_names=2
on Windows. This preserves the lettercase of database and table names. The disadvantage of this is that you must ensure that your statements always refer to your database and table names with the correct lettercase on Windows. If you transfer your statements to Unix, where lettercase is significant, they do not work if the lettercase is incorrect.
一些链接:
lower_case_table_names
System Variable- Identifier Case Sensitivity
这篇关于mysql从linux转储到Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!