zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    POJ-1182 食物链
    P1020 导弹拦截
    牛客寒假训练营2-C算概率
    牛客寒假训练营2-H施魔法
    牛客寒假算法训练营2-建通道
    D
    C
    A
    B
    【Luogu3366】【模板】最小生成树
  • 原文地址:https://www.cnblogs.com/dreamfine/p/6901355.html
Copyright © 2011-2022 走看看