I am trying to access my database from outside but it does not leave me with the root user my server is debian 10 and my database is mysql 8 I have tried to give it permissions but it gives me the following error does anyone know what is happening??:
mysql> GRANT ALL PRIVILEGES ON * . * TO 'root'@'0.0.0.0';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
The fastest way to know what privileges your current user has is:
Connect with the user
root
and execute the following commands to verify what permissions each existing user has in your database manager:Which should return something like the following:
Where as you can verify the user
demo
does not have privileges assigned and especially does not have the privilegeGRANT
, which is the one necessary for the command you are trying to executeGiven the above then the user cannot assign the permission
GRANT
to another user; for which we should do the following:So we do:
According to the MySQL 8 documentation in the other account characteristics section, it indicates:
Which could be translated as:
The optional clause
WITH
is used to enable the user to grant permissions to other users. the optionWITH GRANT OPTION
gives the user the ability to give other users whatever privileges the user has at the specified privilege level.Now if the user in question already has privileges and just looking to add the user
GRANT OPTIONS
then run the command like this:So that your current user is in a position to grant permissions
GRANT
to any other user.If you run
SELECT
the top one again like so:You will get something like this:
Where you can already notice that the permission
GRANT
exists for the userdemo
and therefore you can grant it to other usersReferences
GRANT
a user in MySQL 8I can already access
UPDATE user SET host='%' WHERE user='root';
it is solved by saying that the root user can access from any host