top of page
![](https://static.wixstatic.com/media/11062b_fac51a38acf24ea2aa030216e01a0ea3f000.jpg/v1/fill/w_288,h_162,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/11062b_fac51a38acf24ea2aa030216e01a0ea3f000.jpg)
Syntax:
RANDOM_BYTES(len)
This function returns a binary string of len random bytes generated
using the random number generator of the SSL library. Permitted values
of len range from 1 to 1024. For values outside that range, an error
occurs.
RANDOM_BYTES() can be used to provide the initialization vector for the
AES_DECRYPT() and AES_ENCRYPT() functions. For use in that context, len
must be at least 16. Larger values are permitted, but bytes in excess
of 16 are ignored.
RANDOM_BYTES() generates a random value, which makes its result
nondeterministic. Consequently, statements that use this function are
unsafe for statement-based replication.
URL: https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html
Example
bottom of page