在/etc/mysql/中,我看到两个配置文件: my.cnf和mysql.cnf
两者的内容几乎相同。其中一个最近通过apt-get进行了更新。看起来其中一个已经过时了。
有人能解释一下这两个有什么区别吗?我能删掉其中一个吗?
这里使用Ubuntu 16.10和Mysql 5.7.8。
发布于 2017-06-12 20:19:40
我也有同样的问题。
我假设您指的是/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 documentation包含一个表,描述了各种配置文件的用途,但没有提到mysql.cnf。
/etc/my.cnf全局文件全局选项SYSCONFDIR/my.cnf全局options$MYSQL_HOME/my.cnf服务器特定的选项(服务器默认使用-- options/etc/mysql/my.cnf -SYSCONFDIR/my.cnf-options$MYSQL_HOME/my.cnf指定的文件,如果有任何~/.my.cnf用户特定的options~/.mylogin.cnf用户特定的登录路径选项(仅限客户端)从this blog的这两个配置文件的内容可以看出,我的理论似乎是正确的。
在我的系统上,我实际上有相当多的其他配置文件,它们对应于MySQL的各个部分,所以您可以编辑这些文件,而不是使用各个部分。
mysqld
这些属性适用于MySQL服务器,您可以使用以下文件:/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
发布于 2017-09-17 01:04:23
它们是相同的文件。
在Ubuntu16.04中,/etc/mysql/my.cnf是到/etc/alternatives/my.cnf的符号链接,默认情况下是到/etc/mysql/mysql.cnf的符号链接。
似乎有很多符号链接,但他们想让MySQL从/etc/mysql/my.cnf中读取内容,并使用alternatives机制。
https://stackoverflow.com/questions/43080687
复制相似问题