Thursday, January 7, 2010

MySQL's load_file Function

I didn't know about this function till I read http://praetorianprefect.com/archives/2009/12/unu-cracks-a-wall-street-journal-conference-site-not-wsj-com/.

dennis@ipa:~$ mysql -u root -h 192.168.1.102
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.0.77-log OpenBSD port: mysql-server-5.0.77

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select load_file("/tmp/dennis")\G
*************************** 1. row ***************************
load_file("/tmp/dennis"): i'm a file on 192.168.1.102

1 row in set (0.00 sec)

Pending the usual file permissions and MySQL File privileges, you can read a file located on the database server.

Reference:

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_load-file

No comments:

Post a Comment