Windows MySQL read file is null

Source: Internet
Author: User
Tags mysql version

Log only the method that solves the problem.

MySQL version: 5.7.18

Problem: When executing MySQL function load_file, the function loads the contents of the specified file and stores it in the corresponding field. Such as:

Select Load_file ("D:\aa.txt");

However, the execution always returns NULL. Various slashes have been tried.

Accessed data: 1190000009333563

MySQL new version under secure-file-priv field: Secure-file-priv parameter is used to limit load DATA, SELECT ... OUTFILE, and Load_file () to which the specified directory is passed.

    • The value of Ure_file_priv is null, which means that the restriction mysqld does not allow import | export

    • When the value of Secure_file_priv is/tmp/, the import that restricts the Mysqld | Export can only occur in the/tmp/directory

    • When the value of Secure_file_priv does not have a specific value, it means that there is no restriction on MYSQLD import | export

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

1 show global variables like ‘%secure%‘;

The default is null. Import and export is not allowed.

Modify the Mysql.ini file and add it under [mysqld]

Secure_file_priv =

Save and restart MySQL.

To perform a command view:

Execute LoadFile again:

Problem solving.

Windows MySQL read file is null

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.