如何在没有mysql的数据库上授予数据库特权?

我想知道如何在没有表的数据库上授予权限。

我试过以下内容:

将全部数据库名称授予username @ hostname;

它向我显示一个错误,说“在用户表中找不到任何匹配的行”。


你有没有尝试过这样的事情,

mysql> create database amarokdb;
Query OK, 1 row affected (0.00 sec)

mysql> grant usage on *.* to amarokuser@localhost identified by 'amarokpasswd';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on amarokdb.* to amarokuser@localhost ;
Query OK, 0 rows affected (0.00 sec)

您的服务器可能启用了NO_AUTO_CREATE_USER模式。

从MySQL手册:(http://dev.mysql.com/doc/refman/5.6/en/server-sql-mode.html)

NO_AUTO_CREATE_USER可防止GRANT语句自动创建新用户,除非还指定了非空密码。 (在MySQL 5.0.2中添加)

因此,您可以删除NO_AUTO_CREATE_USER模式或使用像这样的密码创建用户:

GRANT ALL ON databasename TO username@hostname IDENTIFIED BY 'your non-empty password here'
链接地址: http://www.djcxy.com/p/69271.html

上一篇: how to grant privileges on a database without table in mysql?

下一篇: apache2 not loading php codes