Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将登录页面从一台服务器迁移到另一台服务器。旧服务器托管一个 SQL 服务器数据库和一个新的 MySQL。登录页面使用用户表中的 guid 来识别具有会话变量的用户。在 MySQL 中是否有类似的替代方法?
您可以使用以下函数生成通用唯一标识符:UUID()
UUID()
mysql> select uuid(); bb2647fb-bed7-11e2-a78a-001f166db385
存储您可以使用的其中之一CHAR(36)。
CHAR(36)
创建唯一 ID(在该表中)的标准 MySQL 方法是使用PRIMARY KEY AUTO_INCREMENT列。请参阅文档。
PRIMARY KEY
AUTO_INCREMENT