An error is reported when MySQL uses a file to import data:
Loading local data is disabled; this must be enabled on both the client and server sides
Interim solution:
Enter the MySQL login command on the command line:
mysql –local-infile=1 -u root -p
Setting variable: set global local_ infile=1;
View variables: show global variables like ‘local_ infile’;
mysql> show global variables like ‘local_ infile’;
+—————+——-+
| Variable_ name | Value |
+—————+——-+
| local_ infile | ON |
+—————+——-+
1 row in set (0.00 sec)
There is no problem importing the file, but the above error will still be prompted when the MySQL service is restarted
Permanent solution: automatically load the configuration and modify the MySQL configuration file when the MySQL service is started
In mysqld.cnf
Add
local under [mysqld]
_ infile = 1
In mysql.cnf
[mysql]
Add
local under_ infile = 1
MySQL service restart
service mysql restart
Command line view local_ Infile variable status
mysql> SHOW GLOBAL VARIABLES LIKE ‘local_ infile’;
+—————+——-+
| Variable_ name | Value |
+—————+——-+
| local_ infile | ON |
+—————+——-+
1 row in set (0.00 sec)
Description configuration succeeded
Import file OK
local_ The infile server variable indicates whether the load data local infile command can be used. This variable defaults to on.
when this variable is off, the load data local infile command on the client is disabled.
Similar Posts:
- MySQL reports an error using load data local infile
- How to Solve MySQL Secure file priv error
- [Solved] MYSQL ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot e…
- MySQL external import data error [How to Solve]
- The ‘INFORMATION_SCHEMA.GLOBAL_STATUS’ feature is disabled; see the documentation for …
- [Solved] MYSQL Error 1040 (HY000): too many connections
- [Solved] MYSQL Export Sheet Error: –secure-file-priv option so it cannot execute this statement
- Mysqldump error: tab (ErrCode:13-Permission denied) [How to Solve]
- [Solved] MySQL Error: ERROR 1615 (HY000): Prepared statement needs to be re-prepared
- MySQL Error: [Err] 1071 – Specified key was too long; max key length is 767 bytes