[英]What is the difference between my.cnf vs mysql.cnf?
在/ etc / mysql /中我看到两个配置文件:my.cnf和mysql.cnf
两者的内容几乎相同。 最近通过apt-get更新了其中一个。 看起来其中一个已经过时了。
有人可以解释这两者之间的区别是什么,如果我可以删除其中一个?
在这里使用Ubuntu 16.10和Mysql 5.7.8。
tl; dr他们是同一个文件。
在Ubuntu 16.04 /etc/mysql/my.cnf
是一个符号链接/etc/alternatives/my.cnf
默认为一个符号链接/etc/mysql/mysql.cnf
。
看起来像很多符号链接,但他们希望MySQL从/etc/mysql/my.cnf
读取并使用替代机制。
我也有同样的问题。
我假设您的意思是/etc/mysql/my.cnf
和/etc/mysql/mysql.cnf
因为我实际上有很多MySQL配置文件。
我测试过,两者都是必需的 - 除非它们都存在,否则MySQL不会启动,即使它们包含相同的内容。
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
根据我的理解, mysql.cnf
是Ubuntu特定的MySQL设置, my.cnf
是MySQL的默认设置。
MySQL文档包含一个表,描述了各种配置文件应该用于什么,但它没有提到mysql.cnf。
/etc/my.cnf
全球选项 /etc/mysql/my.cnf
全局选项 SYSCONFDIR/my.cnf
全局选项 $MYSQL_HOME/my.cnf
特定于服务器的选项(仅限服务器) defaults-extra-file
使用--defaults-extra-file指定的文件(如果有) ~/.my.cnf
用户特定选项 ~/.mylogin.cnf
用户特定的登录路径选项(仅限客户端) 正如你可以从这个博客中看到这两个配置文件的内容我的理论似乎是正确的。
在我的系统上,我实际上有相当多的其他配置文件对应于MySQL的各个部分,因此您可以编辑它们而不是使用各个部分。
的[mysqld]
这些属性适用于MySQL Server,您可以使用此文件: /etc/mysql/mysql.conf.d/mysqld.cnf
[MySQL的]
这些属性适用于MySQL客户端(命令行),您可以使用此文件: /etc/mysql/conf.d/mysql.cnf
[mysqld_safe的]
当您使用mysql_safe以安全模式启动时,这些属性适用于MySQL,可在此文件中找到: /etc/mysql/conf.d/mysqld_safe_syslog.cnf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.