一尘不染

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

mysql

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

show grants 显示:

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

我没有任何用户ID,但是当我要成为一个用户时,我没有特权,即使我没有一个用户,我也不知道如何授予特权!

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

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

阅读 515

收藏
2020-05-17

共1个答案

一尘不染

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

2020-05-17