
ERROR 3948 (42000)
While running my shell script to import CSV file data into a MySQL table, I encountered the following error.
ERROR 3948 (42000): Loading local data is disabled; this must be enabled on both the client and server sides
How to fix it?
You need to explicitly enable loading local files on both server and client sides.
Fix on MySQL server side (mysqld)
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
Under [mysqld], explicitly add:
[mysqld]
local_infile=1
Restart MySQL server after editing:
sudo systemctl restart mysql
And here’s another error I encountered….
ERROR 2068 (HY000)
ERROR 2068 (HY000): LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
How to Fix Immediately (Client-Side Restrictions)
Open or create your MySQL client configuration file at:
vim ~/.my.cnf
Add these lines explicitly allowing local file access:
[client]
local_infile=1
loose-local-infile=1
Save the file.
Then, ensure it has secure permissions:
chmod 600 ~/.my.cnf