mysql uuid binary_MySql 之UUID()

mysql中做了个定时执行的事件,发现原来起作用,现在不行了。

调用/var/lib/mysql中的错误日志文件,发现一句:

Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.

原来目前用的mysql版本低,UUID函数不支持MySQL 复制的STATEMENT模式。

先改代码吧,保证对低版本的兼容性:

BEGIN

-- UUID函数属于不确定性函数,为此不支持MySQL 复制的STATEMENT模式,但是支持MIXED、ROW二种模式

-- 在复制模式下,需要用到UUID()函数,则一定要使用基于行/混合模式复制方式。

set binlog_format = MIXED;

insert into Users(userName,guid,userpinyin,userpy,uper)

select DISTINCT userName, UUID(), to_pinyin(userName),to_pinyinsx(userName),Domain from t_zhangdan a

where not exists(select 1 from Users where userName=a.userName);

END

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值