Solution to secure-file-priv problem when exporting MySQL data

Solution to secure-file-priv problem when exporting MySQL data

ERROR 1290 (HY000) : The MySQL server is running with the –secure-file-priv option so it cannot execute this statement.

I believe that most students who perform MySQL data export operations for the first time will encounter the above errors. As for why this error occurs, the reason is very simple: we don't know where the default export directory of MySQL is, and we don't even know that MySQL has restrictions on the export directory of data. This is actually normal, because it is impossible for us to know everything. As long as we can find the correct solution and remember it after encountering a problem, it is enough! Learning is a process of continuous accumulation.

Next, let's take a look at how to solve this problem: After we install MySQL, a configuration file named my.ini will be automatically generated. This file records all the default configurations of MySQL, such as port number, default character set, default storage engine, and so on. This configuration file is located in the hidden folder ProgramData. For details on how to find this hidden folder, please refer to the detailed method for viewing the storage location of MySQL data files.

In addition, we can also view the current value of secure-file-priv through the command:

show variables like '%secure%';

Execute the above command to test:

6

As shown in the figure above, the secure-file-priv value I set is D:/CoderLife/testMySQL, and the default value of MySQL is:

secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads"

We can view and modify it by opening the my.ini configuration file:

7

As shown in the figure above, I commented out the default value of MySQL and changed it to my own specified path. In fact, after we modify the contents of this configuration file, such as changing the default value of secure-file-priv, we must shut down MySQL and restart it to make it take effect. Here, we need to pay attention to the following: shutting down MySQL does not mean simply exiting MySQL with the exit command or closing the MySQL window, but shutting down the MySQL service and then restarting the service . As for how to start and stop the MySQL service, please refer to the detailed description of the MySQL database crash after entering the password and the solution.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL online log library migration example
  • How to clean up data in MySQL online database
  • How to create a table in mysql and add field comments
  • Optimized implementation of count() for large MySQL tables
  • Introduction to the use of MySQL source command
  • Causes and solutions for MySQL too many connections error
  • Solve the problem of secure_file_priv null

<<:  Solution to the problem that the virtual machine Ubuntu 16.04 cannot connect to the Internet

>>:  Solution to the problem that Ubuntu cannot connect to the Internet in the virtual machine

Recommend

Installation and use of mysql mycat middleware

1. What is mycat A completely open source large d...

Notes on Using Textarea

Why mention textarea specifically? Because the tex...

Website background music implementation method

For individual webmasters, how to make their websi...

How to build php7 with docker custom image

First, perform a simple Docker installation. To c...

Detailed explanation of the simple use of MySQL query cache

Table of contents 1. Implementation process of qu...

Detailed explanation and extension of ref and reactive in Vue3

Table of contents 1. Ref and reactive 1. reactive...

MySQL extracts Json internal fields and dumps them as numbers

Table of contents background Problem Analysis 1. ...

Common usage of regular expressions in Mysql

Common usage of Regexp in Mysql Fuzzy matching, c...

HTML table tag tutorial (7): background color attribute BGCOLOR

The background color of the table can be set thro...

Jenkins Docker static agent node build process

A static node is fixed on a machine and is starte...

Web componentd component internal event callback and pain point analysis

Table of contents Written in front What exactly i...

Implementation of multi-site configuration of Nginx on Mac M1

Note: nginx installed via brew Website root direc...

Detailed explanation of Vue's custom event content distribution

1. This is a bit complicated to understand, I hop...

How to draw a mind map in a mini program

Table of contents What is a mind map? How to draw...

Detailed explanation of nginx forward proxy and reverse proxy

Table of contents Forward Proxy nginx reverse pro...