Store UUID v4 in MySQL

后端 未结 7 798
栀梦
栀梦 2020-12-08 06:58

I\'m generating UUIDs using PHP, per the function found here

Now I want to store that in a MySQL database. What is the best/most efficient MySQL field format for st

相关标签:
7条回答
  • 2020-12-08 07:50

    This could be useful if you use binary(16) data type:

    INSERT INTO table (UUID) VALUES
       (UNHEX(REPLACE(UUID(), "-","")))
    
    0 讨论(0)
提交回复
热议问题