mysql复制不兼容语句问题

发布于 2024-09-14 17:00:23 字数 846 浏览 2 评论 0原文

我想设置一个新的 mysql 数据库从属运行较新版本的 mysql => 5.1.41比大师=> 5.0.75,据我所知,通常应该没有问题。然而,事实证明设置复制失败,因为我在 5.0.75 中使用了一条 SQL 语句,该语句显然在 5.1.41 中不再工作:

导致问题的语句如下所示:

DELETE FROM tab1 t1
USING       tab1 t1, tab2 t2
WHERE       t2.field1 = ...
AND         t2.field2 = ...
AND         t1.field1 = t2.field2;

此语句在 5.0.75 上完美运行,在 5.1.41 上,我在我的从属状态中收到以下错误消息:

...
Last_SQL_Errno: 1064
Last_SQL_Error: Error '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 't1
                USING       tab1 t1, tab2 t2
                ...
...

有什么想法,发生了什么以及该怎么办?

谢谢!

更新

好吧,我通过自己在从属设备上编译 5.0.75 解决了这个问题...但是,我仍然感兴趣,发生了什么以及如何处理此类问题。谢谢。

i wanted to setup a new mysql database slave running a newer version of mysql => 5.1.41 than the master => 5.0.75, which -- as far as i know -- should normally be no problem. however, as it turns out setting up replication fails, because i used a SQL statement in 5.0.75 which apparently does not work in 5.1.41 anylonger:

the statement which causes the trouble looks like:

DELETE FROM tab1 t1
USING       tab1 t1, tab2 t2
WHERE       t2.field1 = ...
AND         t2.field2 = ...
AND         t1.field1 = t2.field2;

this statements runs perfectly on 5.0.75, on 5.1.41 i get the following error message in my slave status:

...
Last_SQL_Errno: 1064
Last_SQL_Error: Error '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 't1
                USING       tab1 t1, tab2 t2
                ...
...

any ideas, what's going on and what to do?

thanks!

UPDATE

ok, i solved this problem by compiling 5.0.75 on the slave myself ... however, i would still be interested, what's going on and how to deal with such problems. thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅笑轻吟梦一曲 2024-09-21 17:00:23

对于这样的错误(这并不重要),您可以在 my.ini 文件中过滤掉。

# skip replication errors
slave-skip-errors=1062,1136,1146

或者修改有问题的代码,使其版本友好。

For errors like this (that aren't important) you can filter out in the my.ini file.

# skip replication errors
slave-skip-errors=1062,1136,1146

Or alternatively modify the offending code so that it is version friendly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文