mysql 客户端“.my.cnf”的位置是什么?在 Windows 版 XAMPP 中?
在 Windows 中使用 XAMPP 的 mysql 客户端 .my.cnf
的位置是什么?
澄清:这个文件默认不存在,那么当你创建它时,你应该把它放在哪里,以便命令行客户端自动读取它?
What is the location of mysql client .my.cnf
using XAMPP in Windows?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
输入以下内容:
然后查看输出。大约 3/4 处有一段文本块描述了它从哪些文件中找到了默认值
.my.cnf
。这是来自 XAMPP v3.2.1 的示例,默认选项是按给定顺序从以下文件中读取的:您的设置可能有所不同。必须运行命令来检查特定系统上的实际路径。
Type this:
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 example from XAMPP v3.2.1, default options are read from the following files in the given order:Your setup may differ. You will have to run the command to check the actual paths on your particular system.
查看 MySQL 配置文件
C:\xampp\mysql\bin\my.ini
。该文件的顶部有一些注释:
它告诉您在哪里可以找到
.my.cnf
文件。Look in the MySQL config file
C:\xampp\mysql\bin\my.ini
.At the top of that file are some comments:
There it tells you where to find your
.my.cnf
file.在使用
mysql --help
检查 Win7 上的默认位置后,找不到任何配置文件,我手动搜索 my.ini 并在C:\ProgramData\MySQL\MySQL Server 找到它xy
(是的,ProgramData
,而不是Program Files
)。虽然我在 Program Files 中使用了自己的 my.ini,但其他配置覆盖了我的设置。
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 atC:\ProgramData\MySQL\MySQL Server x.y
(yep,ProgramData
, notProgram Files
).Though I used an own my.ini at
Program Files
, the other configuration overwrote my settings.转到控制面板→服务,查找MySQL并右键单击选择属性。如果存在,在“EXE文件的路径”中,有一个类似
--defaults-file="X:\path\to\my.ini"
的参数,这是服务器实际使用的文件(与
mysql --help
打印的内容无关)。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
--defaults-file="X:\path\to\my.ini"
this is the file the server actually uses (independent of what
mysql --help
prints).使用 XAMPP 控制面板,单击 MySQL 的“配置”按钮,您将找到它当前正在使用的文件。
Using the XAMPP control panel, click on the Config button for MySQL and you'll find the file it's currently using.
XAMPP 使用一个名为 mysql_start.bat 的文件来启动 MySQL,如果您使用文本编辑器打开该文件,您可以看到正在尝试使用的配置文件,在当前版本中它是:
如果您在默认路径上安装了 XAMPP,则意味着它位于
c:/xampp/mysql/bin/my.ini
如果不知何故该文件不存在,您应该打开控制台终端(开始 -> 输入“cmd”,按 Enter),然后写“mysql --help”,它会打印一条提及默认位置的文本,在当前版本的 XAMPP 中是:
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:
If you installed XAMPP on the default path it means it is on
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:
它通常位于 MySQL 安装文件夹中,如 C:\Program Files\MySQL\MySQL Server 5.5\my.ini 或
C:\xampp\mysql\bin
(如果不是)在那里,很可能你没有,并且 MySQL 只是加载默认值。
您可能必须启用隐藏的文件和文件夹才能看到它。转到文件夹选项:在任何文件夹中,转到顶部水平主文本菜单 >>工具>>文件夹选项。启用“查看隐藏文件和文件夹”和“查看受保护的系统文件”,保存并保存出口
It's usually in your MySQL installation folder like in
C:\Program Files\MySQL\MySQL Server 5.5\my.ini
orC:\xampp\mysql\bin
If it's not there, it's highly possible that you have none, and that MySQL is just loading default values.
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
如果您使用 MySQL Workbench 连接到服务器,请在左侧菜单中添加查看“管理”和“选项文件”,然后该服务器使用的配置文件的位置将显示在右侧窗格的底部。
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.
在 Windows 上,您可以打开命令窗口并键入命令
Or:(
取决于您的风格和版本)将输出类似以下内容:
从这里您可以看到 my.ini 文件的位置。
您还可以使用相同的“sc”命令更改它,如下所示:
或者:
例如:
On Windows you can open a command window and type the command
Or:
which (depending on your flavor and version) will output something like:
From this you can see the location of the my.ini file.
You can also change it with the same "sc" command like this:
Or:
For example:
在文件夹
c:\xampp\mysql
中自行创建它。Create it yourself in folder
c:\xampp\mysql
.抱歉复活这个帖子,但对于 Windows 8.x 用户可以在此文件夹中找到 my.cnf:
然后也可以在同一文件夹中找到 data 文件夹。
Apologize for resurrect this thread, but for Windows 8.x users can find my.cnf at this folder:
Then also can find data folder on same folder.
如果您使用 Cygwin,此命令将向您显示位置:
If you're on Cygwin this command will show you the locations:
您可以在 C:\ProgramData\MySQL\MySQL Server 5.7 中找到它
You can find it in C:\ProgramData\MySQL\MySQL Server 5.7
我没有安装 XAMPP,但是当我找不到 my.cnf 或 my.ini 时,我确实遇到了问题(我在 Windows 计算机上找不到 my.cnf) 已关闭,并引导至此处。
因此 - 如果您在 Windows 上安装了 MariaDB,并遵循 Windows 最佳实践在
\program files
之外的其他位置加载数据 - 在我的例子中是在“d:”驱动器上,那么您的my .ini
将位于您放置“数据”目录的位置。I don't have XAMPP installed, but the question I did end up at when I couldn't find the my.cnf or my.ini (I can not find my.cnf on my windows computer) was closed, and led here.
So - If you've installed MariaDB on Windows, and followed Windows best practices to load data somewhere OTHER than
\program files
- in my case on a "d:" drive, then yourmy.ini
will be located where you put your "data" directory.如果您直接使用 Windows 2008 服务器上的社区安装程序安装它,它将驻留在 c:\ProgamData\MySql\MysqlServerVersion\my.ini
If you install it directly with the community installer on windows 2008 server, it will reside on c:\ProgamData\MySql\MysqlServerVersion\my.ini