The problem of MySQL import file failure in CentOS environment

Preface##

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.

surroundings##

Linux environment: CentOS7.8
MySQL version: 8.0.21

Error##

Error: Loading local data is disabled; this must be enabled on both the client and……

Configuration method##

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.

statement##

**This article is original, please declare the source for reprinting! **

Recommended Posts

The problem of MySQL import file failure in CentOS environment
Centos 8.1.1911 solves the problem of yum reinstallation
LVM disk expansion problem of Centos7 in Linux
Modify the default encoding of mysql5.6 under CentOS7
Install MySQL5.7 in centos7
Installation and simple practice of MySQL in ubuntu environment (1)
Environment configuration of JDK, mysql and tomcat under Centos7
Rapid deployment of Kubernetes (k8s) cluster in CentOS7 environment
Encountered in the process of building a virtual environment in ubuntu
CentOS environment installation of Docker
Detailed explanation of the installation and use of SSH in the Ubuntu environment
The usage of wheel in python
Analysis of Hyper-V installation CentOS 8 problem
Detailed use of nmcli in CentOS8
Install MySql with Docker in CentOS7
Overview of the Ubuntu file system
Performance comparison of MySQL centos 6 vs 7
The latest Centos7 installation Mysql8 guide
The usage of tuples in python
Tomcat configuration JMX in centos 6.5 environment
Description of in parameterization in python mysql
Understanding the meaning of rb in python
The software environment required for Centos7 installation
Installation and use of Mysql under CentOS
The locate file search command in Ubuntu16.04
The usage of Ajax in Python3 crawler
Centos-6.5 installation and deployment of LNMP environment
Centos install the latest version of cmake
Linux environment construction: CentOs + Apache + MySQL + PHP
Centos7 compile and install MySQL8 problem record
CentOS container installation in Docker uses MySQL
Python and scrapy deployment in centos environment
The fourth installment of Zabbix under CentOs7
Detailed tutorial on installing MySQL 8 in CentOS 7
[Centos8] The bumpy process of installing docker
Docker those things in the Ubuntu environment
The specific method of python import library
Simple practice of RHCS cluster in CentOS6