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

Summary of some points to note when registering Tomcat as a service

Here are some points to note when registering Tom...

Solution to mysql server 5.5 connection failure

The solution to the problem that mysql cannot be ...

Web Design Tutorial (4): About Materials and Expressions

<br />Previous Web Design Tutorial: Web Desi...

Example code for using Nginx to implement 301 redirect to https root domain name

Based on SEO and security considerations, a 301 r...

How to use JS to parse the excel content in the clipboard

Table of contents Preface 1. Paste Events and Cli...

Solution to using html2canvas to process Dom elements with Baidu map into images

Problem 1: Baidu Map uses tiled images (the map i...

How to set horizontal navigation structure in Html

This article shares with you two methods of setti...

Vue3 encapsulates its own paging component

This article example shares the specific code of ...

IDEA2021 tomcat10 servlet newer version pitfalls

Because the version I used when I was learning wa...

How to solve jQuery conflict problem

In front-end development, $ is a function in jQue...

Detailed process of compiling and installing Storm on Kylin V10 server

1 Introduction Apache Storm is a free, open sourc...

CSS positioning layout (position, positioning layout skills)

1. What is positioning? The position attribute in...

Detailed tutorial on installing Docker on CentOS 8

1. Previous versions yum remove docker docker-cli...

How to update Ubuntu 20.04 LTS on Windows 10

April 23, 2020, Today, Ubuntu 20.04 on Windows al...