Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use the secure_file_priv parameter of MYSQL?

Shulou Source: shulou.com Published: 2022-06-01 18:15:15 10月03日 Update

How to use the secure_file_priv parameter of MYSQL? To solve this problem, today the editor summarizes this article about secure_file_priv, hoping to help friends understand the new feature of secure_file_priv.

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

After reading the above, do you have any further understanding of the secure_file_priv parameters of MYSQL? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Parameters features restrictions content files more permissions directories problems effects no skills articles friends industry information information channels paths channels enter one Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Shulou Tech Info Shulou Information OPPO Reno