Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Commonmark migration
Source Link

Am I getting the 'GRANT command denied' error because even though I am root, CURRENT_USER() is identified as 'root'@'%' and GRANT ALL PRIVILEGES 'WITH GRANT OPTION' is only given to 'root'@'localhost' and therefore, 'root'@'%' is not evaluating to be the equivalent of 'root'@'localhost'?

Yes, you are correct. Snippet from mysql documentation

To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting.

 

The WITH GRANT OPTION clause gives the user the ability to give to other users any privileges the user has at the specified privilege level. You should be careful to whom you give the GRANT OPTION privilege because two users with different privileges may be able to combine privileges!

The solution would be connect mysql from localhost with root user and change the privilege of root@%.

Am I getting the 'GRANT command denied' error because even though I am root, CURRENT_USER() is identified as 'root'@'%' and GRANT ALL PRIVILEGES 'WITH GRANT OPTION' is only given to 'root'@'localhost' and therefore, 'root'@'%' is not evaluating to be the equivalent of 'root'@'localhost'?

Yes, you are correct. Snippet from mysql documentation

To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting.

 

The WITH GRANT OPTION clause gives the user the ability to give to other users any privileges the user has at the specified privilege level. You should be careful to whom you give the GRANT OPTION privilege because two users with different privileges may be able to combine privileges!

The solution would be connect mysql from localhost with root user and change the privilege of root@%.

Am I getting the 'GRANT command denied' error because even though I am root, CURRENT_USER() is identified as 'root'@'%' and GRANT ALL PRIVILEGES 'WITH GRANT OPTION' is only given to 'root'@'localhost' and therefore, 'root'@'%' is not evaluating to be the equivalent of 'root'@'localhost'?

Yes, you are correct. Snippet from mysql documentation

To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting.

The WITH GRANT OPTION clause gives the user the ability to give to other users any privileges the user has at the specified privilege level. You should be careful to whom you give the GRANT OPTION privilege because two users with different privileges may be able to combine privileges!

The solution would be connect mysql from localhost with root user and change the privilege of root@%.

Source Link
masegaloeh
  • 18.5k
  • 10
  • 62
  • 114

Am I getting the 'GRANT command denied' error because even though I am root, CURRENT_USER() is identified as 'root'@'%' and GRANT ALL PRIVILEGES 'WITH GRANT OPTION' is only given to 'root'@'localhost' and therefore, 'root'@'%' is not evaluating to be the equivalent of 'root'@'localhost'?

Yes, you are correct. Snippet from mysql documentation

To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting.

The WITH GRANT OPTION clause gives the user the ability to give to other users any privileges the user has at the specified privilege level. You should be careful to whom you give the GRANT OPTION privilege because two users with different privileges may be able to combine privileges!

The solution would be connect mysql from localhost with root user and change the privilege of root@%.