php - 对 MySQL session /用户的文件权限

标签 php mysql mysql-error-1045

当有人在我的 MySQL 数据库中注册时,此功能必须有效:

mysql_query("SELECT mail 
               FROM users 
               INTO OUTFILE 'test.txt'");

但是我得到了错误

Access denied for user 'registerdb'@'%' (using password: YES)

那么我如何将 FILE 写入权限授予 session /用户?

最佳答案

检查该用户的权限:

SHOW GRANTS FOR 'registerdb'@'%'

如果没有列出的FILE权限,直接添加:

GRANT FILE ON . to 'registerdb'@'%'

然后:

FLUSH PRIVILEGES;

但是请注意,通过对 *.* 授予 FILE 权限,您实际上是 giving that user full access to any file the server .

限制limit the location in which files can be read and written, set the secure_file_priv system to a specific directory .

关于php - 对 MySQL session /用户的文件权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7271502/

相关文章:

php - 从今天开始的 MySQL 日期查找器

php - MySQL认证错误: "Access denied for user ' xxx' @'yyy' "?的原因

php - 简单的 PHP If 语句错误

php - MySQL/潜在客户管理/营销事件 - 结构

php - 如何在 PHP 中处理多元化

php - 什么时候应该使用 stdClass,什么时候应该在 php oo 代码中使用数组?

html - JSP Bootstrap Div 列问题

mysql - 当行大小太大时如何转换MYSQL UTF-8?

MySQL:用户 'test' @'localhost' 的访问被拒绝(使用密码:YES),root 用户除外

mysql - golang 编辑先前设置的标志。 MySQL错误1045