Is mysql auto increment safe to use as userID?

后端 未结 5 1253
刺人心
刺人心 2021-01-04 14:54

I am working on website that allows people to create profiles online. I was wondering if it is the right choice to use MySQL AUTO_INCREMENTed IDs as my user ids

5条回答
  •  粉色の甜心
    2021-01-04 15:23

    No, it is not a good idea because auto_increment ids are not easily portable. For your user ids you want ids that can be backed up, restored, moved between database instances, etc. without worrying about collision of ids.

    It would be better to generate a unique number or alpha-numeric string using something like UUID.

提交回复
热议问题