Error: [error code] 1290 – the MySQL server is running with the — secure file priv option
mysql>show variables like '%secure%';;
secure_file_prive=null --Restrict mysqld to disallow imports and exports
secure_file_priv=/tmp/ -- Restrict mysqld import and export to occur only in the /tmp/ directory
secure_file_priv=' ' -- do not restrict mysqld import/export
Solution:
Open my.ini file: add: Secure File priv = “D/JB” to the file
1. Import the test.csv file into mysql
load data infile 'D:/jb/a.csv' -- CSV file storage path
into table test -- the name of the table into which the data is to be imported
fields terminated by ',' optionally enclosed by '"' escaped by '"' -- fields separated by commas, strings enclosed by double quotes, strings themselves enclosed by two double quotes
lines terminated by '\r\n'; -- data lines are separated by \r\n
The successful results are as follows:
2. Import tes.csv file into MySQL (including Chinese)
a. Open the CSV file with a text editor, save it in utf8 format, and then import it
load data infile 'D:/jb/a.csv' -- CSV file storage path
into table test character set 'utf8' -- the name of the table to import the data into, set the encoding
fields terminated by ',' optionally enclosed by '"' escaped by '"' -- fields separated by commas, strings enclosed by double quotes, strings themselves enclosed by two double quotes
lines terminated by '\r\n'; -- data lines are separated by \r\n
3. Export the data in the library to a CSV file (including Chinese)
select * from test
into outfile 'D:/jb/b.csv' character set 'gbk'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
The results are as follows:
Similar Posts:
- When MySQL uses select statement to export table data, error 1290 is reported
- [Solved] MYSQL Error [Error Code] 1290 – The MySQL server is running with the –secure-file-priv option
- [Solved] MYSQL Export Sheet Error: –secure-file-priv option so it cannot execute this statement
- MySQL import file prompt — secure file priv option problem
- [Solved] MYSQL ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot e…
- How to Solve MySQL Secure file priv error
- Mysqldump error: tab (ErrCode:13-Permission denied) [How to Solve]
- MySQL reports an error using load data local infile
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- How to Solve MYSQL Startup Error: “MySQL Daemon failed to start”