在配置mysql主从复制时,想通过

grant replication slave on bbs.* to 'bbs'@'192.168.1.3' identified by '123456';

来限制主从复制只作用于bbs数据库,但是上面的语句会报错:Incorrect usage of DB GRANT and GLOBAL PRIVILEGES 因为replication slave 的级别是global,所以不能只作用于某一数据库,而是全局,如下图说明:

mysql主从复制报错 :Incorrect usage of DB GRANT and GLOBAL PRIVILEGES-LMLPHP

所以还是要通过 grant replication slave on *.* to 'bbs'@'192.168.1.3' identified by '123456';并在/etc/my.cnf中添加binlog-do-db=bbs来限制主从复制的数据库为bbs

05-11 22:20