Топ-100
top of page
Волнистый абстрактный фон
CerebroSQL

LOAD_FILE

Database: MySQL

68747470733a2f2f7374796c65732e7265646469746d656469612e636f6d2f74355f32716d366b2f7374796c65

Topic

Syntax:
LOAD_FILE(file_name)

Reads the file and returns the file contents as a string. To use this
function, the file must be located on the server host, you must specify
the full path name to the file, and you must have the FILE privilege.
The file must be readable by the server and its size less than
max_allowed_packet bytes. If the secure_file_priv system variable is
set to a nonempty directory name, the file to be loaded must be located
in that directory. (Prior to MySQL 8.0.17, the file must be readable by
all, not just readable by the server.)

If the file does not exist or cannot be read because one of the
preceding conditions is not satisfied, the function returns NULL.

The character_set_filesystem system variable controls interpretation of
file names that are given as literal strings.

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

Example

mysql> UPDATE t
SET blob_col=LOAD_FILE('/tmp/picture')
WHERE id=1;

bottom of page