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

  • 相关阅读:
    将博客搬至CSDN
    Linux-进程管理&网络管理
    MySQL架构备份之双机热备
    Linux目录结构&文件管理
    markdown文件即 .md 的基本常用编写语法
    Nginx
    Java 面试题(收集整理...ing)
    CentOS7 VS CentOS8
    Linux 学习
    vi/vim 命令整理
  • 原文地址:https://www.cnblogs.com/dreamfine/p/6901355.html
Copyright © 2011-2022 走看看