16.12.11


MYSQL database replication - master/slave setup...(debian 6.0.3, mysql-server 5.1.49-3)

master:/etc/mysql/my.cnf add, (un)comment the following:
##bind-address          = 127.0.0.1
#listen to all
##master
server-id               = 1
log_bin                 = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M
binlog_do_db            = some_database_that_you_want_to_replicate

restart mysqld (master)
/etc/init.d/mysql restart

add account for replication
$ mysql -hlocalhost -uroot -p
mysql> GRANT REPLICATION SLAVE ON *.* TO 'myreplicator'@'localhost' IDENTIFIED BY 'myreplicatorpassword';
mysql> FLUSH PRIVILEGES;

slave:/etc/mysql/my.cnf
##slave
##server id has to be > 1
server-id = 2
master-host = master.ip.address
master-user = myreplicator
master-password = myreplicatorpassword
master-connect-retry = 60
#db to replicate
replicate-do-db = name_of_db_to_replicate

restart mysqld (slave)

/etc/init.d/mysql restart


i was getting following error when running 'load data from master;' command from mysql>:
ERROR 1188 (HY000): Error from master:  'some-view-type-table' is not BASE TABLE'

to solve this add this line to my.cnf on slave:
replicate-ignore-table = name_of_db.name_of_table_to_ignore

0 comments: