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. Returns NULL if len is NULL.

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.

If RANDOM_BYTES() is invoked from within the mysql client, binary
strings display using hexadecimal notation, depending on the value of
the --binary-as-hex. For more information about that option, see
https://dev.mysql.com/doc/refman/8.0/en/mysql.html.

URL: https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html

