MySQL Data export permissions issue

Source: Internet
Author: User

There are many ways to export MySQL data, such as mysqldump, mysql-e ' sql ' > file, which can be easily exported, but there is a problem when exporting data with ordinary users.

1
Select * into outfile ' File_path ' from my_table

The above statement is also a way for MySQL to export data, when the use of ordinary users to execute the statement, an error occurred:

1
ERROR1045(28000): Access denied forUser' My_user '@'% '(Using Password:yes)

The user has previously been granted authorization on the corresponding database, as follows:

1
grant all on My_database.*  to my_user;

As you can see from the above statement, all permissions have been given to my_user, but the problem persists. Where does the problem come from? Google after a while found that MySQL has a separate file permissions, need to be given separately, and file is a global permission, can not just give a single database file permissions to the user. After the reason is found, the file permissions are assigned to the appropriate user:

1
Grant file on *. * to My_user;

Executes the export statement again and executes successfully.

For more articles, please visit the little Fat Xuan .

MySQL Data export permissions issue

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.