fbpx

Enabling LOAD DATA LOCAL INFILE in MySQL

You'll need to enable local infile in MySQL to use the Mumara's Rocket Import functionality while imporyt importing a contact list. Also make sure that this feature will just let you import just email addresses and not the additional fields.

Before we proceed further, below are the quick commands to find and enable local-infile.

In SQL CLI (command line interface), run the following

SHOW GLOBAL VARIABLES LIKE 'local_infile';
SET GLOBAL local_infile = 'ON';
SHOW GLOBAL VARIABLES LIKE 'local_infile';

It should print the results similar to the following

mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
1 row in set (0.00 sec)
mysql> SET GLOBAL local_infile = 'ON';
Query OK, 0 rows affected (0.06 sec)
mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set (0.00 sec)
mysql>

If it still says ‘OFF’, then look deep within the compiler settings to enable it.
If it sets to ‘ON’, you are OK.
Please note I did not say

SET GLOBAL local_infile = 1;

I said use

SET GLOBAL local_infile = 'ON';

If setting this in my.cnf

[mysqld]
local_infile=ON

and restarting mysql does not work either, you will have to start up mysql with something like this:

echo "SET GLOBAL local_infile = 'ON';" > /var/lib/mysql/init_file.sql
chown mysql:mysql /var/lib/mysql/init_file.sql
service mysql stop
service mysql start --init-file=/var/lib/mysql/init_file.sql
rm -f /var/lib/mysql/init_file.sql

or perhaps adding this to my.cnf

[mysqld]
init-file=/var/lib/mysql/init_file.sql

then restart mysql
Cheers!!!

Wasif Ahmad

I'm not much sure about myself!

View all posts

Add comment