当我手动执行数据时,我的数据会从主数据库中复制,但是当它从PHP插入主数据库时,它不会被复制到从数据库。
我的主数据库 - my.cnf
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = database
我的奴隶数据库 - my.cnf
server-id = 2
log_bin = /var/log/mysql/mysql-bin.log
relay-log = /var/log/mysql/mysql-relay-bin.log
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = database
replicate_do_db = database
slave_net_timeout = 30
sync_master_info = 1
sync_relay_log = 1
sync_relay_log_info = 1
我的数据库表设置
`id` int(11) NOT NULL AUTO_INCREMENT,
`tmdbid` varchar(9) NOT NULL,
`poster` varchar(256) NOT NULL,
`title` varchar(128) NOT NULL,
`tagline` varchar(128) NOT NULL,
`plot` text NOT NULL,
`year` year(4) NOT NULL,
`release` varchar(18) NOT NULL,
`runtime` char(6) NOT NULL,
`genres` varchar(256) NOT NULL,
`actors` text NOT NULL,
`votes` varchar(5) NOT NULL,
`mpaa` varchar(6) NOT NULL,
`file2` text NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`link` text NOT NULL,
`file` text NOT NULL,
`link1` text,
`link2` text,
`uploaded` text,
`been_sent_to_folder` text,
`poster_backup` varchar(256) NOT NULL,
`saved_poster_name` text NOT NULL,
`poster140x100` varchar(256) NOT NULL,
`poster65x95` varchar(256) NOT NULL,
`poster_orig` varchar(256) NOT NULL,
PRIMARY KEY (`tmdbid`),
KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
要插入数据库的PHP
mysql_query("INSERT INTO `database`.`tmdb` (`id`,`tmdbid`,`poster`,`title`,`tagline`,`plot`,`year`,`release`,`runtime`,`genres`,`actors`,`votes`,`mpaa`,`file2`,`link`,`file`,`poster_backup`,`saved_poster_name`,`poster140x100`,`poster65x95`,`poster_orig`) VALUES (NULL,'".$tmdbid."','".$poster."','".$title."','".$tagline."','".$plot."','".$year."','".$imrelease."','".$runtime."','".$genres."','".$actors."','".$votes."','".$mpaa."','".$file2."','".$link."','".$file."','".$poster_backup."','".$saved_poster_name."','".$finalthumb."','".$imgfinal."','".$imgfinal225."');")...
答案 0 :(得分:1)
此处是Offtopic,但要回答:binlog-do-db
与基于语句的日志记录相结合通常是一个糟糕的决定:
转到基于ROW
的日志记录,或只是复制所有数据库,我通常更喜欢后者。