I keep getting this error.
I am using mySQL Workbench and I found that root's schema permissions are empty. There are no privileges at all.
I'm having issues on various platforms I'm using my server on, and this is a problem that pops up out of the blue.
root@127.0.0.1Apparently there is a lot of access, but I log in like this, but it is only assigned to localhost - localhost has no permissions.
I did some things likeFLUSH HOSTS
,FLUSH PRIVILEGES
etc. But no success from that method or from the internet.
How can I restore root access? I find this frustrating because when I look around people expect you to "have access" but I don't have access so I can't get into the command line or anything andGRANT
do it myself anything.
RunSHOW GRANTS FOR root
This is what I get in return:
Error code: 1141. No such authorization is defined for user 'root' Host "%"
If you encounter the same problem in MySql 5.7.:
This is because MySql 5.7 allows socket connections by default, which means you only need to use
sudo mysql
to connect. If you run sql:Then you will see it:
To allow connections using root and password, update the values in the table using the command:
Then run the select command again and you will see it has changed:
That's it. You can run this procedure after running and completing the
sudo mysql_secure_installation
command.For mariadb, use
set password. For more information please visithttps://mariadb.com/kb/en/set-password/
UsageInstructions for resetting the root password- But instead of resetting the root password, we will force insert a record into the mysql.user table
In initialization files, use this instead of