错误1044(42000)。用户''@'localhost'对数据库'db'的访问被拒绝。
我想开始用MySQL写查询。
show grants
显示。
+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
我没有任何用户名,但当我想建立一个用户时,我没有权限,我也不知道如何在我没有一个用户的情况下建立权限!
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
152
3
不,你应该在bash中运行
mysql -u root -p
,而不是在MySQL命令行。 如果你在mysql中,你可以通过输入exit退出。你可能需要为你的MySQL数据库设置一个根账户。
在终端键入。
然后调用MySQL客户端。
你可能想试试完整的登录命令。
其中主机为
127.0.0.1
。这样做只是为了确保合作存在。
使用
mysql -u root -p
允许我进行大量的数据库搜索,但由于路径设置,拒绝任何数据库的创建。