load_file is not working in MySQL / MariaDB

Load_File returns a NULL value in MySQL / MariaDB

LOAD_FILE on execution in Windows operating system on Mysql database returns the null value on insertion

create table testfile ( sqlfile text)

insert into testfile values (load_file('C:\dump.sql'));

Cause: It not taking the file path \ as \

Solution: Correct the path with double \\. It will insert the dump file into the column as its present in text file.

insert into testfile values (load_file('C:\\dump.sql'));

-- MySQL dump 10.13 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.