What is the difference between my.cnf and mysql.cnf?

In / etc / mysql / I see two config files: my.cnf and mysql.cnf

Both have nearly the same content. One of them was recently updated via apt-get. It looks like one of them is outdated.

Can someone please explain what is the difference between the two and if I can remove one of them?

Using Ubuntu 16.10 and Mysql 5.7.8 here.

+3


source to share


2 answers


I have the same question.

I assume you meant /etc/mysql/my.cnf

and /etc/mysql/mysql.cnf

because I actually have a lot of MySQL config files.

I've tested and both are required - MySQL won't start if both are present, even though they contain the same content.

# 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/

      

From what I understand these mysql.cnf

are the MySQL Ubuntu settings and my.cnf

these are the default MySQL settings.

The MySQL documentation has a table describing what the various config files should be used for, but it doesn't mention mysql. CNF.

  • /etc/my.cnf

    Global parameters
  • /etc/mysql/my.cnf

    Global parameters
  • SYSCONFDIR/my.cnf

    Global parameters
  • $MYSQL_HOME/my.cnf

    Server options (server only)
  • defaults-extra-file

    File specified with -defaults-extra-file, if any
  • ~/.my.cnf

    Custom parameters
  • ~/.mylogin.cnf

    User interface login path options (clients only)

And as you can see from the contents of these two config files from this blog , my theory seems to be correct.



On my system, I actually have a few more config files that correspond to different MySQL sections, so you can edit them instead of using different sections.

[aces]

These properties are for MySQL Server and you can use this file: /etc/mysql/mysql.conf.d/mysqld.cnf

[MySQL]

These properties are for MySQL Client (command line) and you can use this file: /etc/mysql/conf.d/mysql.cnf

[mysqld_safe]

These properties are for MySQL when started in safe mode with mysql_safe and can be found in this file:/etc/mysql/conf.d/mysqld_safe_syslog.cnf

+3


source


tl; dr This is the same file.

In Ubuntu 16.04, a /etc/mysql/my.cnf

symbolic link to /etc/alternatives/my.cnf

, which by default is a symbolic link to /etc/mysql/mysql.cnf

.



Seems like a lot of symbolic links, but they wanted MySQL to read from /etc/mysql/my.cnf

and also use the alternatives mechanism.

+1


source







All Articles