mysql数据同步问题

zoutuo 2011-12-25 10:45:44
server-id=2
master-host=192.168.1.200
master-user=slave1
master-password=123456
master-port=3333
master-connect-retry=60
replicate-do-db=zoutuo


这个是我slave端my.ini的配置,现在这样配置后服务器不来,报错:

111225 22:23:40 [Note] Plugin 'FEDERATED' is disabled.
111225 22:23:40 InnoDB: The InnoDB memory heap is disabled
111225 22:23:40 InnoDB: Mutexes and rw_locks use Windows interlocked functions
111225 22:23:40 InnoDB: Compressed tables use zlib 1.2.3
111225 22:23:40 InnoDB: Initializing buffer pool, size = 55.0M
111225 22:23:40 InnoDB: Completed initialization of buffer pool
111225 22:23:40 InnoDB: highest supported file format is Barracuda.
111225 22:23:40 InnoDB: Waiting for the background threads to start
111225 22:23:41 InnoDB: 1.1.8 started; log sequence number 1595675
111225 22:23:41 [ERROR] MySQL: unknown variable 'master-host=192.168.1.200'
111225 22:23:41 [ERROR] Aborting

111225 22:23:41 InnoDB: Starting shutdown...
111225 22:23:41 InnoDB: Shutdown completed; log sequence number 1595675
111225 22:23:41 [Note] MySQL: Shutdown complete

它提示错误的变量“master-host=192.168.1.200”。这是为什么呢?
...全文
205 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
yq510457 2011-12-28
  • 打赏
  • 举报
回复
你主从机的MySQL版本分别是多少?从机MySQL版本不能低于主机的MySQL版本的。
yangfei_01 2011-12-27
  • 打赏
  • 举报
回复
http://www.mike.org.cn/articles/mysql-master-slave-sync-conf-detail/
可以参考一下这篇文章,说的很详细
yangfei_01 2011-12-27
  • 打赏
  • 举报
回复
change master to master_host='192.168.1.200', master_user='', master_password='', aster_log_file='', master_log_pos=;
不写在配置文件中(my.ini),在mysql的shell中执行。
zoutuo 2011-12-27
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 yangfei_01 的回复:]

http://www.mike.org.cn/articles/mysql-master-slave-sync-conf-detail/
可以参考一下这篇文章,说的很详细
[/Quote]
mysql> change master to master_host='192.168.1.200', master_user='slave1',master
_password='123456',master_log_file='mysql-log.000005' master_log_pos='107';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'maste
r_log_pos='107'' at line 1
我这么写有问题吗,我觉得写的对呢?
还有你发的这个链接我打不开啊?
zoutuo 2011-12-27
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 yangfei_01 的回复:]

http://www.mike.org.cn/articles/mysql-master-slave-sync-conf-detail/
可以参考一下这篇文章,说的很详细
[/Quote]

mysql> change master to master_host='192.168.1.200', master_user='slave1',master
_password='123456',master_log_file='mysql-log.000005' master_log_pos='107';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'maste
r_log_pos='107'' at line 1
mysql>

我这么写有问题吗?怎么提示错误呢?还有你给的这个链接我打不开啊。
zoutuo 2011-12-27
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 zuoxingyu 的回复:]

引用 1 楼 rucypli 的回复:
master-host这个参数已经废弃了


你需要用change master to master_host='ss',master_user='aa',master_password='sss',master_log_file='ss',master_log_pos=4;来设置slave


楼主的数据库版本是多少?
5.1大版本下,这……
[/Quote]
Server version: 5.5.19-log MySQL Community Server (GPL)
zuoxingyu 2011-12-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 rucypli 的回复:]
master-host这个参数已经废弃了


你需要用change master to master_host='ss',master_user='aa',master_password='sss',master_log_file='ss',master_log_pos=4;来设置slave
[/Quote]

楼主的数据库版本是多少?
5.1大版本下,这个参数是可用的,5.5下可能被废弃了。
yangfei_01 2011-12-26
  • 打赏
  • 举报
回复
从服务器配置文件

server-id = 2
log-bin = /data0/mysql/binlog/binlog
replicate-do-db = test
replicate-ignore-db = mysql, information_schema


change master to master_host='192.168.1.200', master_user='', master_password='', aster_log_file='', master_log_pos=;

master_log_file,master_log_pos由上面主服务器查出的状态值中确定。master_log_file对应File,master_log_pos对应Position。这些都可以在主服务器上查出来
show master status

mysql 5.x以上版本已经不支持在配置文件中指定主服务器相关选项。
rucypli 2011-12-26
  • 打赏
  • 举报
回复
master-host这个参数已经废弃了


你需要用change master to master_host='ss',master_user='aa',master_password='sss',master_log_file='ss',master_log_pos=4;来设置slave
zoutuo 2011-12-26
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 yangfei_01 的回复:]

从服务器配置文件
SQL code

server-id = 2
log-bin = /data0/mysql/binlog/binlog
replicate-do-db = test
replicate-ignore-db = mysql, information_schema


SQL code

change master to master_host='192.168.1.20……
[/Quote]
你好!change master to也是写在my.ini里的吗?
zoutuo 2011-12-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 rucypli 的回复:]

master-host这个参数已经废弃了


你需要用change master to master_host='ss',master_user='aa',master_password='sss',master_log_file='ss',master_log_pos=4;来设置slave
[/Quote]
你好!change master to是写在my.ini里的吗?

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧