ERROR 1044 (42000): Access denied for user ‘root’@’localhost’

What are the eight life cycle hook functions of Vue>>>

Colleagues reported that a MySQL 5.6 creation user could not be authorized, and prompted [error 1044 (42000): access denied for user ‘root’ @’localhost ‘]. As follows:

mysql> grant all on xxx.* to [email protected]'localhost' identified by 'xxx';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'xxxx'
mysql> 

The root user should not have permission. Check the permissions

[[email protected]][mysql]> select current_user() from dual;
+----------------+
| current_user() |
+----------------+
| [email protected] |
+----------------+
1 row in set (0.00 sec)

[[email protected]][mysql]> select host,user from user where user='root';
+-----------+------+
| host      | user |
+-----------+------+
| %         | root |
| localhost | root |
+-----------+------+
2 rows in set (0.00 sec)

[[email protected]][mysql]> show grants for root;
+--------------------------------------------------------------------------------------------------------------------------------+
| Grants for [email protected]%                                                                                                              |
+--------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' WITH GRANT OPTION |
+--------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

It looks ok. Just look at grant_ Priv’s permission is up

[[email protected]][mysql]> SELECT host,user,password,Grant_priv,Super_priv FROM mysql.user;
+-----------+---------+-------------------------------------------+------------+------------+
| host      | user    | password                                  | Grant_priv | Super_priv |
+-----------+---------+-------------------------------------------+------------+------------+
| %         | root    | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | N          | Y          |
+-----------+---------+-------------------------------------------+------------+------------+
1 rows in set (0.00 sec)

Find grant_ Priv permission is n, that is to say, the root user cannot authorize other users. Try y instead

[[email protected]][mysql]> UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
[[email protected]][mysql]> FLUSH PRIVILEGES;

Try adding users again, no problem

mysql>  grant all on xxx.* to [email protected]'192.168.%' identified by 'test1249';
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Similar Posts: