Access denied for User 'root'@'localhost' - Insufficient permissions?
P粉826283529
2023-08-07 14:35:51
<p>I keep getting this error. <br /><br />I'm using MySQL Workbench and from what I've found the root user's permissions appear to be empty. No permissions at all. <br /><br />I am having issues with root on multiple platforms and this has been going on for a long time. <br /><br />root@127.0.0.1 seems to have a lot of permissions, but when I log in as root it just assigns the permissions to the local computer - the local computer has no permissions. <br /><br />I have tried FLUSH HOSTS, FLUSH PRIVILEGES and other methods, but none of them succeeded. <br /><br />I need root access. I get so frustrated because when I'm around people who seem to expect me to have access, I actually don't have access, so I can't go into the command line or do anything, and can't grant myself any permissions. <br /><br />When running SHOW GRANTS FOR root, I get the following return: </p><p><code></code></p>
<blockquote>
<p>Error Code: 1141. There is no such grant defined for user 'root' on
host '%'</p>
</blockquote><p><br /></p>
If you have this problem in MySQL 5.7.:
Because MySQL 5.7 allows connections via sockets by default, this means you only need to connect to MySQL with administrator privileges.
tThen I saw
Allow to connect with administrator privileges and enter a password, then update the values in the table with the command:
Then run the select command again and you will see that it has changed:
Then this is it. After completing the sudo mysql_secure_installation command, you can run the following procedure.
For mariadb, use:
Then set the password. For more information, see https://mariadb.com/kb/en/set-password/.
Instructions for using resetting password - but instead of resetting the password, force insert a record into the mysql.user table