【发布时间】:2020-08-12 00:57:15
【问题描述】:
这里是 MySQL 新手,
我已经在我的 Windows 10 机器上安装了 MySQL,并且可以使用 MySQL Workbench 和 root 用户名进行连接,并且一切正常。
但是,现在我想创建另一个用户进行连接,并让该用户访问服务器上的一个数据库。
我已经使用这些命令创建了用户:
CREATE USER 'user'@'localhost' IDENTIFIED BY 'f^rest_of_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
我已经用这个命令创建了数据库:
CREATE DATABASE wordpress
所以,现在我尝试使用该用户和密码在 MySQL Workbench 中创建连接,但失败了。 错误消息说:
Cannot Connect to Database Server
Your connection attempt failed for user 'user' to the MySQL server at localhost:3306
Please:
1 Check that MySQL is running on address localhost
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the user user has rights to connect to loclahost from your address (MySQL rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for loclahost connecting from the host address you're connecting from
我的下一步是什么?
谢谢, 欧文
【问题讨论】:
-
如果您使用的是 mysql 工作台,为什么不在那里创建用户。
标签: mysql mysql-workbench