mysql从linux转储到windows

标签 mysql database linux windows mysql-workbench

美好的一天堆栈溢出。

我在将 sql 文件导入我的 Windows 机器时遇到问题。 sql文件来自linux机器。发生的事情是来自 linux 的表名是驼峰式的,当迁移到 windows 时,全部变成小写。我不想调整我的代码来访问我的数据库,所以无论如何我可以在 Windows 中实现驼峰式表名吗?

非常感谢。


来自 linux 表名: -> FooBar

在windows中导入mysql workbench时: -> 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。按照用户手册的“Identifier Case Sensitivity”部分,您有两个选择:

Use lower_case_table_names=1 on all systems. The main disadvantage with this is that when you use SHOW TABLES or SHOW DATABASES, you do not see the names in their original lettercase.

Use lower_case_table_names=0 on Unix and lower_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.

一些链接:

关于mysql从linux转储到windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13225379/

相关文章:

mysql - sql : Counting growth over time

database - 如何为依赖动态数据的函数编写单元测试?

mysql - 需要有关 mysql 模式设计的帮助 - 当前模式需要触发器中的动态 sql

php - 将图像插入 SQL 表

mysql - 一个用于 MySQL 保留和运算符单词和短语的库

database - VB.NET从另一个类引用新表单对象的 ListView

c# - 如何控制急切加载数据映射器的获取深度?

html - 是否有类似 Webmaster's Toolkit 的东西可以在 Linux 上运行?

linux - 在 Linux 上使用 Haskell 获取前台窗口标题

mysql - 你能推荐一个免费的 Linux 轻量级 MySQL GUI 吗?