mysql批量补充uuid, Function UUID() and REPLACE(), can't work together

2019-01-02 19:10:50

参考 mysql批量补充uuid

2.补全uuid


update user u

inner join (select id, replace(uuid(),"-","") uuid from user ) r on r.id = u.id

SET u.uuid = r.uuid

where u.uuid = '' or u.uuid is null


当mysql字符集编码为uftmp4,查询replace(uuid(),"-","")一致,就是所有的uuid经过replace都会成相同的uuid

解决办法

replace(convert(uuid() using utf8mb4), '-','')


  • 2019-09-29 10:28:04

    程序员实用工具网站

    程序员开发需要具备良好的信息检索能力,为了备忘(收藏夹真是满了),将开发过程中常用的网站进行整理。

  • 2019-10-08 13:14:44

    MySQL 批量修改表名

    功能:将数据库 booksystem 中的表名前缀是 sys_ 开头的表名替换 sys_ 为 qun_