MySQL5.7 enables bin-log function

1. The bin-log function of MySQL 5.7 is enabled:

(1) In MySQL 5.7 version, the location of my.cnf is generally in /etc/my.cnf, to add server-id in my.cnf:

[mysqld]
server-id = [serial number]
log-bin=[filename]

    Example 1:

[mysqld]
log-bin=/var/lib/mysql/mysql-bin
server-id=1

    Example 2:

log-bin=mysql-bin
server-id=1

    The log-bin parameter has two functions, one is to enable the binary log function of mysql, and the other is to specify the prefix of the binary log file. When specifying the prefix, you can use either an absolute path, such as the above configuration, or a relative path, such as log-bin=mysql-bin. If a relative path is used, the binary log file will be saved to the mysql data directory.

    The server-id parameter is relatively simple. It is used to specify the server id. The range is 1 ~ (2^32-1). If the server-id is set to 0, the master will refuse all slave connections.

 

(2) Restart the database, command:

# service mysqld restart

 

Note: In MySQL 5.7.3 and later versions, if the server-id is not set, the MySQL service cannot be started after binlog is set.

From: http://blog.lifw.org/post/32097759 Quickly build mysql replication based on binary log files

http://titandeng.blog.51cto.com/823817/1863762 MySQL 5.7 enables binary log (binlog) and precautions

 

 More related knowledge:

From: https://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html

The directory where MySQL 5.7 version related files are located:

Files or Resources Location
Client programs and scripts /usr/bin
mysqld server /usr/sbin
Configuration file /etc/my.cnf
Data directory /var/lib/mysql
Error log file

For RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log

For SLES: /var/log/mysql/mysqld.log

Value of secure_file_priv /var/lib/mysql-files
System V init script

For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld

For SLES: /etc/init.d/mysql

Systemd service

For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld

For SLES: mysql

Pid file /var/run/mysql/mysqld.pid
Socket /var/lib/mysql/mysql.sock
Keyring directory /var/lib/mysql-keyring
Unix manual pages /usr/share/man
Include (header) files /usr/include/mysql
Libraries /usr/lib/mysql
Miscellaneous support files (for example, error messages, and character set files) /usr/share/mysql

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326495834&siteId=291194637