指点成金-最美分享吧

登录

MySQL 5.7 my.cnf 文件在哪里?

佚名 举报

技术标签:

【中文标题】MySQL 5.7 my.cnf 文件在哪里?【英文标题】:Where is MySQL 5.7 my.cnf file? 【发布时间】:2016-11-24 06:03:31 【问题描述】:

在 Ubuntu 中,我在 /etc/my.cnf 中有 mysql 5.6 的 my.cnf 文件。但我找不到 MySQL 5.7 的相同文件。从哪里可以找到?

我在整个 / (根)中进行了查找。但我在任何地方都找不到。有什么线索吗?

我正在尝试设置 max_connections 值。

【问题讨论】:

使用mysqlworkbench设置值。 你有什么实际版本,试试select @@version; 你必须创建它。如果不存在,则对所有内容使用默认设置。 文档有点清楚。 dev.mysql.com/doc/refman/5.7/en/option-files.html 。请参阅 Tim MAHER-DE TROYER 底部的评论 谢谢 Drew,我不知何故错过了那个文档。 【参考方案1】:

在 MySQL 5.7 中,默认的 cnf 位于:

/etc/mysql/mysql.conf.d/mysqld.cnf

【讨论】:

只是给尝试set lower_case_table_names=1(或0、2)的人的注释,在终端输入/etc/home$ mysqld --help --verbose并搜索my.cnf,在 default options 下查找 my.cnf 应该存在的位置,然后检查它们是否确实存在于文件系统中,如果任何位置缺少此文件,请复制 mysqld 的内容.cnf 并将其粘贴到名为 my.cnf 的新文件中(.my.cnf for ~/dir)。【参考方案2】:

mysql --help 打印在下面。

Default options are read from the following files in the given order:/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf The following groups are read: mysql clientThe following options may be given as the first argument:--print-defaults        Print the program argument list and exit.--no-defaults           Don"t read default options from any option file,                        except for login file.--defaults-file=#       Only read default options from the given file #.--defaults-extra-file=# Read this file after the global files are read.--defaults-group-suffix=#                        Also read groups with concat(group, suffix)--login-path=#          Read this path from the login file.

【讨论】:

以上是关于MySQL 5.7 my.cnf 文件在哪里?的主要内容,如果未能解决你的问题,请参考以下文章