Get the App
SLTechnology News&Howtos  ›  Database  › 

MYSQL new feature secure_file_priv read and write file o

Shulou Source: shulou.com Published: 2022-06-01 09:31:16 10月03日 Update

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

Secure-file-priv characteristics

The secure-file-priv parameter is used to restrict LOAD DATA, SELECT... OUTFILE, and LOAD_FILE () to which specified directory.

The value of ure_file_priv is null, which means that mysqld is not allowed to import | Export when the value of secure_file_priv is / tmp/, it means to restrict the import of mysqld | Export can only occur in the / tmp/ directory. When the value of secure_file_priv has no specific value, it means that the import of mysqld is not restricted. | Export is not restricted.

How to view the value of the secure-file-priv parameter:

Show global variables like'% secure%'

No export permission: mysql > show global variables like'% secure%' +-+-+ | Variable_name | Value | +-+-+ | secure_auth | OFF | | secure_file_priv | | +-+-+ 2 rows in set (0.00 sec)

You have export permission. The export path needs to be under / var/lib/mysql-files/:

Mysql > show global variables like'% secure%' +-- +-- + | Variable_name | Value | +-- +-- -+ | require_secure_transport | OFF | | secure_auth | ON | | secure_file_priv | / var/lib/mysql-files/ | +-- +-- + 3 rows in set (0.09 sec)

The influence of secure_file_priv, a new feature of MYSQL, on reading and writing files

This switch defaults to NULL, that is, import and export are not allowed.

Resolve the problem:

Under windows:

Modify my.ini and add secure_file_priv= in [mysqld]

Under linux:

Modify my.cnf and add secure_file_priv= in [mysqld]

The influence of secure_file_priv, a new feature of MYSQL, on reading and writing files

Then restart mysql and query secure_file_priv

Tags: Restrictions properties files parameters permissions directories effects no paths problems queries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Shulou Tech Info vpn Shulou Technology