mysql不同数据库的表复制_从同一个mysql服务器的不同数据库复制表

我有一个服务器有2个数据库,我想将几​​个表从一个数据库复制到另一个数据库.目的是我们使用项目中使用的相同用户表.

正如在其他表中使用InnoDB和用户表的外键我选择了复制方式.

为此,我对my.cnf进行了更改

master-user=root

server-id = 2

replicate-rewrite-db = dou->jobs

replicate-do-table = jobs.auth\_user

replicate-wild-do-table = jobs.geo\_%

replicate-do-table = jobs.user\_profile

replicate-same-server-id = 1

report-host = master-is-slave

binlog-do-db = dou

log-bin

从binlog-do-db同步表并启动slave error.log后,出现下一行:

111112 15:10:22 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='localhost', master_port='3306', master_log_file='', master_log_pos='4'. New state master_host='localhost', master_port='3306', master_log_file='mysql-bin.000074', master_log_pos='106'.

111112 15:10:36 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000074' at position 106, relay log '/var/log/mysql/dell-relay-bin.000001' position: 4

111112 15:10:36 [Note] Slave I/O thread: connected to master 'root@localhost:3306',replication started in log 'mysql-bin.000074' at position 106

似乎在这一步一切正常,显示从属状态显示没有错误.

mysql> show slave status\G;

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: localhost

Master_User: root

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000074

Read_Master_Log_Pos: 814

Relay_Log_File: dell-relay-bin.000002

Relay_Log_Pos: 959

Relay_Master_Log_File: mysql-bin.000074

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table: jobs.user\_profile,jobs.auth\_user

Replicate_Ignore_Table:

Replicate_Wild_Do_Table: jobs.geo\_%

Replicate_Wild_Ignore_Table:

Last_Errno: 0

Last_Error:

Skip_Counter: 0

Exec_Master_Log_Pos: 814

Relay_Log_Space: 1113

Until_Condition: None

Until_Log_File:

Until_Log_Pos: 0

Master_SSL_Allowed: No

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Seconds_Behind_Master: 0

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 0

Last_SQL_Error:

1 row in set (0.00 sec)

ERROR:

No query specified

问题是主更改不会影响从站,但是从站状态会发生变化.

感谢您解决该问题的任何帮助.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值