mysql Access denied for ‘root’ With All Privileges

This tutorial shows you, how to solve mysql Access denied for ‘root’ With All Privileges

First, Identify the user you are logged in as:

select user();
select current_user();

The result for the first command is what you attempted to login as, the second is what you actually connected as. Confirm that you are logged in as root@localhost in mysql.

Grant_priv to root@localhost. Here is how you can check.

mysql> SELECT host,user,password,Grant_priv,Super_priv FROM mysql.user;
+-----------+------------------+-------------------------------------------+------------+------------+
| host      | user             | password                                  | Grant_priv | Super_priv |
+-----------+------------------+-------------------------------------------+------------+------------+
| localhost | root             | ***************************************** | N          | Y          |
| localhost | monarchur | ***************************************** | Y          | Y          |
| localhost | stadlar         | ***************************************** | N         | N          |
+-----------+------------------+-------------------------------------------+------------+------------+

You can see that the Grant_priv is set to N for root@localhost. This needs to be Y. Below is how to fixed this:

UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
FLUSH PRIVILEGES;
GRANT ALL ON *.* TO 'root'@'localhost';

Now you can continue your project. the problem mysql Access denied for ‘root’ With All Privileges solved. Good Luck!!

YouTube channel for video tutorial: https://www.youtube.com/@trainbrain007