The solution to the failure of mysql to set “log-bin”: first modify the [my.cnf] file; then store the log file in binary form; finally find the binary file and use the command to export it.
【Related learning recommendation: mysql tutorial(video)】
The method to solve the failure of mysql to set log-bin:
1. Modify the my.cnf file
log-bin=mysql-bin binlog_do_db=hello
-
log-bin: Setting this parameter means enabling the binlog function and specifying the path name
-
binlog_do_db: Specify the database name for logging
After modifying the file, you need to restart the database service
2 . The log file exists in binary form, find the binary file, and use the command to export
a) Find the storage location of the binary file
[root@CCDT-gluster-1 mysql]# ps -ef | grep mysql root 12017 1 0 13:45 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/home/Mysql/MysqlData --pid-file=/home/Mysql/MysqlData/mysql1. pid mysql 12336 12017 0 13:45 pts/0 00:00:02 /usr/sbin/mysqld --basedir=/usr --datadir=/home/Mysql/MysqlData --plugin-dir=/usr/lib64/mysql/ plugin --user=mysql --log-error=/home/Mysql/MysqlData/CCDT-gluster-1.err --pid-file=/home/Mysql/MysqlData/mysql1.pid root 14080 26031 0 13:50 pts/0 00:00:00 grep mysql root 20668 1 0 May11 ? 00:00:00 mysql -u root -p
b) The binary file is stored in the directory where the database file is located, use the mysqlbinlog command to export
[root@CCDT-gluster-1 mysql]# cd /home/Mysql/MysqlData [root@CCDT-gluster-1 MysqlData]# mysqlbinlog --start-datetime='2016-11-17 12:00:00' --stop-datetime='2016-11-17 17:00:00' mysql-bin.000001 > ./hello.txt
Want to learn more about programming, please pay attention to the php training column!
The above are the details of what to do if mysql fails to set the log-bin. For more information, please pay attention to other related articles on 1024programmer.com!