It's used for replicating a memory table, before restart, there is no err info and replication works fine.

I have tried modifying my.cnf and restarted MySQL for many times, but it doesn't work

show slave status after restart MySQL service:

Slave_IO_Running: No
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Binary log is not open'

show binary logs:

ERROR 1381 (HY000): You are not using binary logging


datadir                         =/var/lib/mysql
socket                          =/var/lib/mysql/mysql.sock
max_connections                 =5000
secure_file_priv                = ''
max_heap_table_size             = 40048576000
tmp_table_size                  = 40048576000
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links                  =0
user                            = mysql
server-id                       = 1
log-bin                         =/var/log/mysql_master/master-bin
log-bin-index                   =/var/log/mysql_master/master-bin.index
innodb_flush_log_at_trx_commit  = 0
sync_binlog                     = 0
binlog-format                   = ROW
log-error                       =/var/log/mysqld.log
pid-file                        =/var/run/mysqld/mysqld.pid

server-id           = 2
port                = 3307
socket              = /var/run/mysqld/mysqld_slave.sock
pid-file            = /var/run/mysqld/mysqld_slave.pid
datadir             = /var/lib/mysql_slave
log_error           = /var/log/mysql_slave/error_slave.log
relay-log           = /var/log/mysql_slave/relay-bin
relay-log-index     = /var/log/mysql_slave/relay-bin.index
master-info-file    = /var/log/mysql_slave/master.info
relay-log-info-file = /var/log/mysql_slave/relay-log.info
read_only           = 1
max_heap_table_size     = 40048576000
tmp_table_size          = 40048576000
user       = multi_admin
password   = 95multi_admin@AAA
log            = /var/log/mysqld_multi.log

show variables like "log_bin";

| Variable_name | Value |
| log_bin       | OFF   |

Don't think you can setup my.cnf with two [mysqld1/2] blocks. You'll have to create two separate my.cnf files for each of the two MySQL instances.

At the moment, it doesn't look like any of the two [mysqld] blocks are being read and applied at all when you start mysql.

Have a look at https://www.howtoforge.com/one_machine_mysql_replication for more details on how to setup replication using one server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.