【发布时间】:2018-07-13 13:31:20
【问题描述】:
我正在使用 MySQL 8.0 设置开发服务器,并尝试从我的笔记本电脑以 root 用户身份远程连接 Workbench。这给了我一个访问被拒绝的错误,因此,尝试应用其他地方提供的解决方案,即授予所有特权......,我仍然没有到达那里。自从发布这些解决方案(例如 [Enable remote MySQL connection: ERROR 1045 (28000): Access denied for user)以来,可能发生了一些变化。
来自服务器:
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -uroot -ppassword
mysql> grant all privileges on *.* to 'root'@'%' identified by 'password';
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 'identified by 'password'' at line 1
如果我删除了消息抱怨的部分:
mysql> grant all privileges on *.* to 'root'@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
有什么建议吗?
谢谢!
R.
【问题讨论】:
-
您可能需要添加用户 'root'@'%',这与 'root'@'localhost' 不同。您可以通过多种方式执行此操作,例如直接
insert to mysql.userstable -
根据 MySQL 文档,MySQL 8.0 似乎在 GRANT 语句中删除了 MySQL 5.7 中存在的“隐式帐户创建”。您需要先使用
CREATE USER创建 MySQL 用户。不建议像@Bacon 所说的那样直接插入mysql.users
标签: mysql remote-access