[英]MySQL: Unable to add an existing user to another Database?
I am trying to add an existing user to another database but I am keep getting the error:我正在尝试将现有用户添加到另一个数据库,但我不断收到错误消息:
ERROR 1410 (42000): You are not allowed to create a user with GRANT
I tried the following, none worked:我尝试了以下方法,但均无效:
GRANT ALL ON db.* TO 'user'@'localhost';
GRANT ALL ON db.* TO 'user'@'localhost' WITH GRANT OPTION;
GRANT ALL ON db.* TO 'user';
I am using MySQL on digitalocean我在 digitalocean 上使用 MySQL
MySQL version: 8.0.31-0ubuntu2
MySQL 版本: 8.0.31-0ubuntu2
Update : I am using root
user.更新:我正在使用root
用户。
According to this oracle blog , it is not possible to create a user from the GRANT command in mysql 8:根据这篇 oracle 博客,无法从 mysql 8 中的 GRANT 命令创建用户:
To start, let's highlight the fact that in MySQL 8.0 it's not any more possible to create a user directly from the GRANT command:首先,让我们强调一个事实,即在 MySQL 8.0 中,不再可能直接从 GRANT 命令创建用户:
It states you have to create a user first, before granting privileges.它声明您必须先创建一个用户,然后再授予权限。 Have you created the user first?您是否首先创建了用户? If not, try that!如果没有,试试看!
You need to create a user 1st.您需要首先创建一个用户。 Follow the below steps.请按照以下步骤操作。
CREATE USER 'username'@'host' IDENTIFIED WITH authentication_plugin BY 'password';
or CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password';
或CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password';
if the 1st command throws an error.如果第一个命令抛出错误。GRANT PRIVILEGE ON database.table TO 'username'@'host';
FLUSH PRIVILEGES;
You can find the full reference in this blog您可以在此博客中找到完整的参考资料
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.