获取表中唯一字符串uuid,可用于随机文件名
在mysql数据库中,可以使用uuid()语句来生成一个UUID:
例如:
mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 44089d46-be85-11e4-b8a8-74d02bb8a8e9 |
+--------------------------------------+
1 row in set (0.04 sec)
或者是去掉‘-’再显示
mysql> select replace(uuid(),'-','');
+----------------------------------+
| replace(uuid(),'-','') |
+----------------------------------+
| 51b32c89be8511e4b8a874d02bb8a8e9 |
+----------------------------------+
1 row in set (0.02 sec)