Mysql LOAD FILE
From w3cyberlearnings
Contents |
MySQL LOAD_FILE Function
This function loads file content from a file. This file has to be in the same host.
Syntax LOAD_FILE
file is path to a file name.
LOAD_FILE(file);
Example 1
mysql> SELECT LOAD_FILE('/tmp/text.txt'); +----------------------------+ | LOAD_FILE('/tmp/text.txt') | +----------------------------+ | wonderful day | +----------------------------+ 1 row in set (0.00 sec)
Example 2
mysql> SET @t2=LOAD_FILE('/tmp/text.txt'); Query OK, 0 rows affected (0.00 sec) mysql> SELECT @t2; +----------------+ | @t2 | +----------------+ | wonderful day | +----------------+ 1 row in set (0.00 sec)