错误 1044 (42000):用户 ''@'localhost' 对数据库 '

ERROR 1044 (42000): Access denied for user #39;#39;@#39;localhost#39; to database #39;db#39;(错误 1044 (42000):用户 @localhost 对数据库 db 的访问被拒绝)
本文介绍了错误 1044 (42000):用户 ''@'localhost' 对数据库 'db' 的访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我想开始在 MySQL 中编写查询.

I want to begin writing queries in MySQL.

show grants 显示:

+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+

我没有任何用户 ID,但是当我想创建一个用户时,我没有特权,即使我没有一个用户,我也不知道如何创建特权!

I do not have any user-id but when I want to make a user I don't have privilleges, also I don't know how to make privileges when even I don't have one user!

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 身份登录:

I tried to sign in as root:

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

推荐答案

不,您应该在 bash 中运行 mysql -u root -p,而不是在 MySQL 命令行中.如果你在 mysql 中,你可以输入 exit 退出.

No, you should run mysql -u root -p in bash, not at the MySQL command-line. If you are in mysql, you can exit by typing exit.

这篇关于错误 1044 (42000):用户 ''@'localhost' 对数据库 'db' 的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Can#39;t Create Entity Data Model - using MySql and EF6(无法创建实体数据模型 - 使用 MySql 和 EF6)
MySQL select with CONCAT condition(MySQL选择与CONCAT条件)
Capitalize first letter of each word, in existing table(将现有表格中每个单词的首字母大写)
How to retrieve SQL result column value using column name in Python?(如何在 Python 中使用列名检索 SQL 结果列值?)
Update row with data from another row in the same table(使用同一表中另一行的数据更新行)
Exporting results of a Mysql query to excel?(将 Mysql 查询的结果导出到 excel?)