Mysql 1290 - The MySQL server is running with the --secure-file-priv option

problem scenario

Execute import data error

The execution statement is as follows:

load data infile 'C:\Users\86183\Desktop\laodInFile.txt' INTO TABLE test.test1;

The error message is as follows:

1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

problem causes

Because the default setting of the secure-file-priv variable is /var/lib/mysql-files/, this value means that it can only be exported to the specified directory (verified), otherwise an error will be reported, check the value of the variable in the mysql database :

show variables like '%secure%';

Analyze the reasons

Detailed explanation of secure-file-priv configuration value:

(1) secure_file_prive=null, restrict mysqld from importing and exporting

(2) secure_file_priv=/var/lib/mysql-files/, restricting the import and export of mysqld can only occur in the /var/lib/mysql-files/ directory

(3) secure_file_priv=' ', does not limit the import and export of mysqld

Solution

(1) Modify the variable value of secure_file_prive.

Open the my.cnf or my.ini file

secure_file_priv = ''

(2) Restart the Mysql service

(3) Check the variable value

(4) Execute the import statement again, and it can be successfully executed.

Guess you like

Origin blog.csdn.net/weixin_36754290/article/details/129267205