<导航

MySQL 中的 base64 函数

MySQL在5.6版本的时候增加了to_base64和from_base64函数,在此之前没有内部函数,只能使用User-Defined-Function。 

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)

mysql> 

 

posted @ 2019-02-11 14:10  字节悦动  阅读(1313)  评论(0编辑  收藏  举报