Home > Database > Mysql Tutorial > body text

mysql数据导出权限问题

WBOY
Release: 2016-06-07 15:21:14
Original
1146 people have browsed it

mysql数据导出的方法有很多,例如mysqldump, mysql -e 'sql' file, 这些都可以很方便的导出数据,可是在使用普通用户导出数据的时候,出现了问题。 1 select * into outfile file_path from my_table 上面的语句也是mysql导出数据的一种方式,在使用普通用户

mysql数据导出的方法有很多,例如mysqldump, mysql -e 'sql' > file, 这些都可以很方便的导出数据,可是在使用普通用户导出数据的时候,出现了问题。

1

select * into outfile "file_path" from my_table

上面的语句也是mysql导出数据的一种方式,在使用普通用户执行语句时,出现了一下错误:

1

ERROR 1045 (28000): Access denied for user 'my_user'@'%' (using password: YES)

之前已经对该用户在对应的数据库上执行了授权,如下:

1

grant all on my_database.* to my_user ;

上面语句可以看出,已经把所有的权限赋予了my_user,可是问题依旧存在。问题到底出现在什么地方呢?google了一下后发现mysql有单独的file权限,需要单独赋予,同时file是一个全局权限,不能够仅仅将单个数据库的文件权限赋予用户。找到原因后,下面就将文件权限赋予相应用户:

1

grant file on *.* to my_user ;

再次执行导出语句,成功执行。

更多文章请前往小胖轩.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!