解决mysql中Access denied for user ‘root‘@‘%‘ to database...的问题

前言

当你需要使mysql的用户授权访问某个数据库的权限时,执行命令后会出现Access denied for user ‘root’@’%’ to database…的情形

缘由

授权的权限没有打开

解决

... ...
mysql> UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost root]# systemctl restart mysql	# 切记需要重启mysql服务

结语

… …

你可能感兴趣的:(grant,mysql)