我最近下载并开始使用mysql。我已经设置了它,希望正确,我的根用户也登录了。mysql 服务也在运行。
我运行以下行来创建 datbase 和新用户,但我无法登录我的新用户。请帮忙。我不知道我做错了什么。
我已经在网上搜索了一个解决方案,但对正确的步骤感到困惑。
谢谢:)
PS C:UsersAkhil> mysql -u root -p;
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 24
Server version: 5.6.41-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| mytestdb |
| performance_schema |
| sakila |
| test |
| world |
+--------------------+
7 rows in set (0.00 sec)
mysql> use mytestdb
Database changed
mysql> create user myuser identified by 'mypass';
ERROR 1396 (HY000): Operation CREATE USER failed for 'myuser'@'%'
mysql> DROP USER myuser;
Query OK, 0 rows affected (0.00 sec)
mysql> create user myuser identified by 'mypass';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON mytestdb.* TO myuser;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
PS C:UsersAkhil> mysql -u myuser -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using password: YES)
PS C:UsersAkhil>
为什么我被拒绝访问超出了我的范围...帮助?
我已经解决了错误。我所做的是使用 root 用户登录。然后键入以下命令:-
DROP USER ''@localhost ;
然后它就像一个魅力!