This article should be applicable to most of this problem. I read a lot of blogs at the time, but they didn't match my Linux environment, so I figured out a solution by myself, which is more detailed, so it will be a bit verbose.
Linux environment: CentOS7.8
MySQL version: 8.0.21
Error: Loading local data is disabled; this must be enabled on both the client and……
Use show global variables like'local_infile'; to view the configuration, as shown below, mine has been changed, the default local_infile field is null, use
SET GLOBAL local_infile = true;
Modified to open.
If you only modify this configuration and then use the import file command, this error will be reported:
Next, I need to modify the configuration file. I read other blogs and confused for a long time. Most of them are to modify mysqld.cnf and other files. My centos only has my.cnf file and my.cnf.d folder under /etc. And the my.cnf.d folder is empty, I found a lot of blogs and finally had to try it by myself. To add local-infile=1,[mysql] to the my.cnf file Both fields and [mysqld] fields must be added, as shown below:
There is no [mysql] field in my file. I added it by myself. If you don't have this field, you can refer to it. After the change, it will be Okay.
**This article is original, please declare the source for reprinting! **
Recommended Posts