MySQL 在 windows xampp 上在哪里更改 lower_case_table_names=2 的值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8550789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:05:11  来源:igfitidea点击:

Where to change the value of lower_case_table_names=2 on windows xampp

mysqlxampp

提问by John x

I am using windows 7 and xamppi am trying to export my database and while in the process the table names are converted to lower case. I have searched a lot, i know i have to change the value of lower_case_table_namesfrom 0to 2but where i have to change this value, in which file?

我正在使用 Windows 7 并且xampp我正在尝试导出我的数据库,并且在此过程中表名被转换为lower case. 我寻觅了很多,我知道我得的值改为lower_case_table_names02,但在这里我不得不改变此值,在哪个文件?

回答by Mohammad Saberi

Do these steps:

执行以下步骤:

  1. open your MySQL configuration file: [drive]\xampp\mysql\bin\my.ini
  2. look up for: # The MySQL server [mysqld]
  3. add this right below it: lower_case_table_names = 2
  4. save the file and restart MySQL service
  1. 打开你的 MySQL 配置文件:[drive]\xampp\mysql\bin\my.ini
  2. 查找: # The MySQL server [mysqld]
  3. 在它下面添加这个: lower_case_table_names = 2
  4. 保存文件并重启 MySQL 服务

From: http://webdev.issimplified.com/2010/03/02/mysql-on-windows-force-table-names-to-lowercase/

来自:http: //webdev.issimplified.com/2010/03/02/mysql-on-windows-force-table-names-to-lowercase/

回答by Sam Barnum

On linux I cannot set lower_case_table_namesto 2(it reverts to 0), but I can set it to 1.

在 linux 上,我无法设置lower_case_table_names2(它会恢复为0),但我可以将其设置为1.

Before changing this setting, do a complete dump of all databases, and drop all databases. You won't be able to drop them after setting lower_case_table_namesto 1, because any uppercase characters in database or table names will prevent them from being referenced.

在更改此设置之前,请对所有数据库进行完整转储,并删除所有数据库。设置lower_case_table_names为 后1,您将无法删除它们,因为数据库或表名中的任何大写字符都会阻止它们被引用。

Then set lower_case_table_namesto 1, restart MySQL, and re-load your data, which will convert everything to lowercase, including any subsequent queries made.

然后设置lower_case_table_names1,重新启动 MySQL,并重新加载您的数据,这会将所有内容转换为小写,包括任何后续查询。

回答by Detect

Try adding/editing lower_case_table_names = 2 in my.inior my.cnf

尝试添加/编辑lower_case_table_names = 2 inmy.inimy.cnf

回答by Jimil Choksi

I have same problem while importing database from linux to Windows. It lowercases Database name aswell as Tables' name. Use following steps for same problem:

我在将数据库从 linux 导入到 Windows 时遇到同样的问题。它小写数据库名称以及表的名称。对同一问题使用以下步骤:

  1. Open c:\xampp\mysql\bin\my.ini in editor.
  2. look for
  1. 在编辑器中打开 c:\xampp\mysql\bin\my.ini。
  2. 寻找

# The MySQL server

[mysqld]

# MySQL 服务器

[mysqld]

3 . Find

3 . 找

lower_case_table_names

lower_case_table_names

and change value to 2

并将值更改为 2



if not avail copy this at the end of this [mysqld] portion.

如果无效,请在 [mysqld] 部分的末尾复制此内容。

lower_case_table_names = 2

lower_case_table_names = 2

This will surely work.

这肯定会奏效。

回答by user3257693

Also works in Wampserver. Click on the Green Wampserver Icon, choose MySql, then my.ini. This will allow you to open the my.ini file. Then -

也适用于 Wampserver。单击绿色 Wampserver 图标,选择 MySql,然后选择 my.ini。这将允许您打开 my.ini 文件。然后 -

  1. look up for: # The MySQL server [mysqld]
  2. add this right below it: lower_case_table_names = 2
  3. save the file and restart MySQL service
  1. 查找: # MySQL 服务器 [mysqld]
  2. 在它的正下方添加:lower_case_table_names = 2
  3. 保存文件并重启 MySQL 服务

Important Note- add the lower_case_table_names = 2statement NOTunder the [mysql] statement, but under the [mysqld]statement

重要说明- 添加lower_case_table_names = 2语句不是在[mysql] 语句下,而是在[mysqld]语句下

Reference - http://doc.silverstripe.org/framework/en/installation/windows-wamp

参考 - http://doc.silverstripe.org/framework/en/installation/windows-wamp

回答by manoj

ADD following -

添加以下 -

  • look up for: # The MySQL server [mysqld]
  • add this right below it: lower_case_table_names = 1 In file - /etc/mysql/mysql.conf.d/mysqld.cnf
  • 查找: # MySQL 服务器 [mysqld]
  • 在它的正下方添加:lower_case_table_names = 1 在文件中 - /etc/mysql/mysql.conf.d/mysqld.cnf

It's works for me.

它对我有用。

回答by golimar

Look for a file named my.ini in your hard disk, in my system it's in

在您的硬盘中查找名为 my.ini 的文件,在我的系统中它位于

c:\program files\mysql\mysql server 5.1

If it's not my.ini it should be my.cnf

如果不是 my.ini 应该是 my.cnf

回答by Yuan

If you have the file my-default.inirename it to my.ini

如果您将文件my-default.ini重命名为my.ini