Hooman Bahreini
Hooman Bahreini

Reputation: 15559

changing my.cnf to setup MySQL replication

I am following this tutorial to set up MySQL replication (I am using Ubuntu).

According to the above tutorial, this is the config that I want in my.cnf file:

[mysqld]
log-bin = mysql-bin
server-id = 1
relay-log = relay-log-slave
gtid-mode =ON
enforce-gtid-consistency
binlog_format = MIXED
log_slave_updates

I have found my.cnf under: /etc/mysql:

enter image description here

When I open my.cnf this is the content (not sure why the file icon appears like a short-cut icon?):

#
# The MySQL database server configuration file.
#                                              /****************************/
# You can copy this to one of:                 /* <-- what does this mean? */   
# - "/etc/mysql/my.cnf" to set global options, /****************************/    
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

I was expecting to find settings like: log-bin, server-id, gtid-mode in my.cnf. I thought I should just change the setting values. I am not sure if this is the correct file, because non of those setting values exists here...

Also the comment on top of the file tells me that I can copy it to /etc/mysql/my.cnf but this is where I opened the file from!! I am confused by this comment...

Is this the correct file? Am I supposed to add all the settings myself?


Update

Looks like all the settings exists in /etc/mysql/mysql.conf.d/mysqlid.cnf, am I supposed to change this file?

Upvotes: 1

Views: 1506

Answers (1)

Raja vikraman
Raja vikraman

Reputation: 169

From MySQL 5.7 default configuration file path is /etc/mysql/mysql.conf.d/mysqld.cnf.

Before 5.7 file path will be /etc/mysql/my.cnf or /etc/my.cnf.

If the parameter does not exist, then add in the [mysqld] section of the configuration file.

Upvotes: 2

Related Questions