MySQL 没有my.cnf,mysql用什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4808363/
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 18:31:18  来源:igfitidea点击:

What does mysql use if there is no my.cnf?

mysqlmy.cnf

提问by Charles

In short, what configuration values does MySQL use if there is no my.cnf?

简而言之,如果没有,MySQL 使用什么配置值my.cnf

I'm running MySQL on Slackware. I've been using it for a while with ISAM and InnoDB tables. I never configured a my.cnffile. Oops. Now I'd like to do that, but I don't know what settings it is using currently, and I'd like to know before I install a my.cnffile and possibly change things.

我在 Slackware 上运行 MySQL。我已经将它与 ISAM 和 InnoDB 表一起使用了一段时间。我从来没有配置过my.cnf文件。哎呀。现在我想这样做,但我不知道它当前使用的是什么设置,我想在安装my.cnf文件并可能进行更改之前知道。

I've done MySQL --helpand checked the locations given.
I've done find / and I'm certain there is no my.cnfor .my.cnffile anywhere.
I've done ps auxand no --defaults_fileis being specified.

我已经完成了 MySQL--help并检查了给定的位置。
我已经找到了 / 并且我确定在任何地方都没有my.cnf.my.cnf文件。
我已经完成ps aux并且没有--defaults_file被指定。

These files exist:

这些文件存在:

/etc/my-medium.cnf
/etc/my-huge.cnf
/etc/my-small.cnf
/etc/my-large.cnf

/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-small.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-large.cnf

/etc/my-medium.cnf
/etc/my-huge.cnf
/etc/my-small.cnf
/etc/my-large.cnf

/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-small.cnf
/usr/share/mysql/my-innodb-heavy-4G .cnf
/usr/share/mysql/my-large.cnf

回答by Marc B

If it can't find a my.cnf or my.ini file, MySQL will use its compiled-in defaults. The .cnf/.ini files are not necessary unless you want to override those defaults.

如果找不到 my.cnf 或 my.ini 文件,MySQL 将使用其编译的默认值。除非您想覆盖这些默认值,否则不需要 .cnf/.ini 文件。

The medium/huge/small/large files you found are suggested setups for that "size" of server. Just pick the one in /etc that suits your needs and rename it to my.cnf (in the same directory), restart mysql, and it should make that configuration take effect.

您找到的中/大/小/大文件是该服务器“大小”的建议设置。只需在/etc中选择适合您需要的一个并将其重命名为my.cnf(在同一目录中),重新启动mysql,它应该使该配置生效。

回答by markus

Do not trust defaults

不要相信默认值

I'm doubting you're actually running mysql without configuration at all. If so, you're running with all the default values which is not only highly inefficientbut also insecure!

我怀疑您实际上是在完全没有配置的情况下运行 mysql。如果是这样,您正在使用所有默认值运行,这不仅效率低下而且不安全

Do not trust the templates provided by mysql

不要相信mysql提供的模板

Unfortunately the files you mention that are suggested by mysql all littered with bad practice and outdated/deprecated configurations. I advice not to trust them but learn about how to really configure your mysql server by searching the web for tutorials about sensible mysql configuration. There is a lot of good material out there.

不幸的是,您提到的 mysql 建议的文件都充斥着不良做法和过时/不推荐使用的配置。我建议不要相信他们,而是通过在网上搜索有关合理 mysql 配置的教程来了解如何真正配置您的 mysql 服务器。那里有很多好材料。

Create your own configuration, it's the best way of learning about what your database server can do!

创建您自己的配置,这是了解您的数据库服务器可以做什么的最佳方式!