首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >错误1044 (42000):用户''@'localhost‘对数据库'db’的访问被拒绝

错误1044 (42000):用户''@'localhost‘对数据库'db’的访问被拒绝
EN

Stack Overflow用户
提问于 2012-01-13 00:44:00
回答 7查看 793.9K关注 0票数 185

我想开始用MySQL编写查询。

show grants显示:

代码语言:javascript
复制
+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+

我没有任何用户id,但是当我想创建一个用户时,我没有权限,而且我也不知道如何在没有一个用户的情况下创建权限!

代码语言:javascript
复制
mysql> CREATE USER 'parsa'@'localhost' IDENTIFIED BY 'parsa';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER pr
ivilege(s) for this operation

我尝试以root用户身份登录:

代码语言:javascript
复制
mysql> mysql -u root -p;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
 -u root -p' at line 1
mysql> mysql -u root -p root;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
 -u root -p root' at line 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8838777

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档