When MySQL uses select statement to export table data, error 1290 is reported

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

When using select… Into output to export data, error 1290 (HY000) is reported. The statement is as follows:

select * into outfile 'd:\abc.txt'
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\n'
from emp;

Error 1290 (HY000): the MySQL server is running with the — secure file priv option so it cannot execute this statement

analysis: prompt message – Secure File priv, it can be seen that the file export is restricted. So modify the restriction information in the configuration

Note:

secure_ file_ Prive = null restricts mysqld from importing and exporting

secure_ file_ Priv = “C/programdata/MySQL/MySQL server 8.0/uploads” restricts the import and export of mysqld to C/programdata/MySQL/MySQL server 8.0/uploads

secure_ file_ Priv = ”does not restrict the import and export of mysqld

solution:

I don’t want to restrict it, so the solution is to add secure to the MySQL configuration file_ file_ priv=’ ‘

1. Open the my.ini file of windows, my version mysql8.0, and the configuration file path is C:// programdata/MySQL/MySQL server 8.0/my.ini

2. Add secure under [mysqld] node of my.ini file_ file_ priv=”

3. Restart mysql8.0 service

Execute the export statement again

Similar Posts: