All pages
Powered by GitBook
1 of 1

Loading...

LOAD_FILE

Read a file from the server. This function reads the content of a file located on the server host and returns it as a string.

Syntax

LOAD_FILE(file_name)

Description

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 all and it must be less than the size, in bytes, of the system variable. If the system variable is set to a non-empty directory name, the file to be loaded must be located in that directory.

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

The system variable has controlled interpretation of file names that are given as literal strings.

Statements using the LOAD_FILE() function are not . This is because the slave will execute the LOAD_FILE() command itself. If the file doesn't exist on the slave, the function will return NULL.

Examples

See Also

This page is licensed: GPLv2, originally from

max_allowed_packet
secure_file_priv
character_set_filesystem
safe for statement based replication
SELECT INTO DUMPFILE
fill_help_tables.sql
UPDATE t SET blob_col=LOAD_FILE('/tmp/picture') WHERE id=1;