MySQL 中的 base64 函数

1. 5.6版本及之后的版本的base64

主要就是两个mysql内部函数to_base64from_base64,使用也很简单,如下:

5.6之前不支持

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.11    |
+-----------+
1 row in set (0.00 sec)

mysql> select to_base64('helloworld');
+-------------------------+
| to_base64('helloworld') |
+-------------------------+
| aGVsbG93b3JsZA==        |
+-------------------------+
1 row in set (0.00 sec)

mysql> select from_base64('aGVsbG93b3JsZA==');
+---------------------------------+
| from_base64('aGVsbG93b3JsZA==') |
+---------------------------------+
| helloworld                      |
+---------------------------------+
1 row in set (0.00 sec)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25





原文地址:https://www.cnblogs.com/edgedance/p/7026435.html