XAMPP for Windows 中 mysql 客户端“.my.cnf”的位置是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4292769/
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
What is the location of mysql client ".my.cnf" in XAMPP for Windows?
提问by Alex R
What is the location of mysql client .my.cnf
using XAMPP in Windows?
mysql 客户端.my.cnf
在 Windows 中使用 XAMPP的位置是什么?
Clarification: This file does not exist by default, so when you create it, where should you place it, in order for the command line client to read it automatically?
澄清:这个文件默认是不存在的,所以当你创建它时,你应该把它放在哪里,以便命令行客户端自动读取它?
采纳答案by Billy
Type this:
输入:
mysql --help
Then look at the output. There is a block of text about 3/4 the way down describing what files it finds its defaults .my.cnf
from. Here is an examplefrom XAMPP v3.2.1:
然后看输出。大约 3/4 处的文本块描述了它.my.cnf
从哪些文件中找到其默认值。这是来自XAMPP v3.2.1的示例:
Default options are read from the following files in the given order:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf C:\xampp\mysql\my.ini C:\xampp\mysql\my.cnf C:\xampp\mysql\bin\my.ini C:\xampp\mysql\bin\my.cnf
Your setup may differ.You will have to run the command to check the actual paths on your particular system.
您的设置可能有所不同。您必须运行该命令来检查特定系统上的实际路径。
回答by Sudantha
Look in the MySQL config file C:\xampp\mysql\bin\my.ini
.
查看 MySQL 配置文件C:\xampp\mysql\bin\my.ini
。
At the top of that file are some comments:
该文件的顶部是一些注释:
# You can copy this file to
# C:/xampp/mysql/bin/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is C:/xampp/mysql/data) or
# ~/.my.cnf to set user-specific options.
There it tells you where to find your .my.cnf
file.
它会告诉您在哪里可以找到您的.my.cnf
文件。
回答by Hein van Dyke
After checking the default locations on Win7 with mysql --help
and unable to find any config file, I manually searched for my.ini and found it at C:\ProgramData\MySQL\MySQL Server x.y
(yep, ProgramData
, not Program Files
).
在 Win7 上检查默认位置mysql --help
并找不到任何配置文件后,我手动搜索 my.ini 并在C:\ProgramData\MySQL\MySQL Server x.y
(yep, ProgramData
, not Program Files
)找到它。
Though I used an own my.ini at Program Files
, the other configuration overwrote my settings.
虽然我在 中使用了自己的 my.ini Program Files
,但其他配置覆盖了我的设置。
回答by Matthias Ronge
Go to control panel → services, look for MySQL and right click choose properties. If there, in “path to EXE file”, there is a parameter like
转到控制面板 → 服务,查找 MySQL 并右键单击选择属性。如果有,在“EXE文件的路径”中,有一个参数,如
--defaults-file="X:\path\to\my.ini"
--defaults-file="X:\path\to\my.ini"
this is the file the server actually uses (independent of what mysql --help
prints).
这是服务器实际使用的文件(与mysql --help
打印内容无关)。
回答by Moustafa Elqabbany
Using the XAMPP control panel, click on the Config button for MySQL and you'll find the file it's currently using.
使用 XAMPP 控制面板,单击 MySQL 的 Config 按钮,您将找到它当前正在使用的文件。
回答by ESG
It's usually in your MySQL installation folder like in C:\Program Files\MySQL\MySQL Server 5.5\my.ini
or C:\xampp\mysql\bin
它通常在您的 MySQL 安装文件夹中,例如 inC:\Program Files\MySQL\MySQL Server 5.5\my.ini
或C:\xampp\mysql\bin
If it's not there, it's highly possible that you have none, and that MySQL is just loading default values.
如果它不存在,很可能你没有,而且 MySQL 只是加载默认值。
You might have to enable hidden Files and Folders to see it. Go to Folder Options: in any folder, go to the top horizontal main text menu >> Tools >> Folder Options. Enable 'View Hidden Files and Folders', and 'View Protected System Files', save & exit
您可能必须启用隐藏的文件和文件夹才能看到它。转到文件夹选项:在任何文件夹中,转到顶部水平主文本菜单 >> 工具 >> 文件夹选项。启用“查看隐藏文件和文件夹”和“查看受保护的系统文件”,保存并退出
回答by Ivan Castellanos
XAMPP uses a file called mysql_start.bat to start MySQL and if you open that file with a text editor you can see what config file is trying to use, in the current version it is:
XAMPP 使用一个名为 mysql_start.bat 的文件来启动 MySQL,如果您使用文本编辑器打开该文件,您可以看到正在尝试使用的配置文件,在当前版本中它是:
mysql\bin\mysqld --defaults-file=mysql\bin\my.ini --standalone --console
If you installed XAMPP on the default path it means it is on c:/xampp/mysql/bin/my.ini
如果您在默认路径上安装了 XAMPP,则表示它已打开 c:/xampp/mysql/bin/my.ini
If somehow the file doesn't exist you should open a console terminal (start-> type "cmd", press enter) and then write "mysql --help" and it prints a text mentioning the default locations, in the current version of XAMPP is:
如果不知何故该文件不存在,您应该打开一个控制台终端(开始-> 键入“cmd”,按回车键),然后写入“mysql --help”并在当前版本中打印一个提及默认位置的文本XAMPP 是:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf C:\xampp\mysql\my.ini C:\xampp\mysql\my.cnf
回答by Glen
If you connect to the server with MySQL Workbench add look at 'Management' and 'Options File' in the menu on the left, then the location of the config file being used by that server is shown at the bottom of the pane on the right.
如果您使用 MySQL Workbench 连接到服务器,请在左侧菜单中添加查看“管理”和“选项文件”,则该服务器正在使用的配置文件的位置将显示在右侧窗格的底部.
回答by Ebrahim Asadi
Create it yourself in folder "c:\xampp\mysql".
在文件夹“c:\xampp\mysql”中自行创建。
回答by Carlos Spohr
Apologize for resurrect this thread, but for Windows 8.x users can find my.cnf at this folder:
为复活此线程而道歉,但对于 Windows 8.x 用户可以在此文件夹中找到 my.cnf:
C:\ProgramData\MySQL\MySQL Server 5.6\my.ini
Then also can find data folder on same folder.
然后也可以在同一文件夹中找到数据文件夹。