MySQL 授权问题

标签 mysql mysql-error-1045 sql-grant

为什么以下 grant 语句可能无法工作?

grant all on kylie.* to 'kylie'@'localhost' identified by 'foo';

这是完整的输出。

$ mysql -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 63
Server version: 5.1.37 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases like 'kylie%';
+-------------------+
| Database (kylie%) |
+-------------------+
| kylie             | 
+-------------------+
1 row in set (0.00 sec)

mysql> grant all on kylie.* to 'kylie'@'localhost' identified by 'foo';
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye

$ mysql -u kylie 
ERROR 1045 (28000): Access denied for user 'kylie'@'localhost' (using password: YES)

这些资助选项似乎每次都能让我受益。我想我已经记住了它们并且文档似乎也可以检查,但它们经常无法工作。我错过了什么?

最佳答案

尝试这样的事情:

mysql -ukylie -pfoo kylie

最后一个 kylie 应该告诉它使用 kylie 作为默认数据库(即你有权限的数据库)。它可能不是必需的,但我想知道它是否适合您。

更新感谢评论。

关于MySQL 授权问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3011516/

相关文章:

php - MySQL 按行中数组的第一个元素排序

mysql - 对文件的查询输出给出拒绝访问错误

php - 警告 : mysql_connect(): Access denied for user '‎‎u1' ?

mysql - 具有授予选项的用户无法授予创建用户

mysql - 是否可以在MySql中封装一个表

Python mysql 连接器加载语句在错误的目录 Windows 中搜索

php - MySQL 数据库中的 Wordpress 膨胀 "session_token"

mysql - 在 SQL 中存储分区集列表的有效方法

c# - MySQL GRANT 给用户 @'host' 未按预期运行

database - 跨模式更改索引