You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
新创建了一个数据库,发现用 root 用户连上之后,无法给新创建的用户授权,提示 access denied for user 'root'@' ' to database 'behappy_prod'。
调查后发现是 root 用户没有 grant 权限:
mysql>select host,user,grant_priv,super_priv from user;
+-----------+---------------+------------+------------+
| host | user | grant_priv | super_priv |
+-----------+---------------+------------+------------+
| localhost | mysql.session | N | Y |
| localhost | mysql.sys | N | N |
| % | root | N | Y |
| % | test | N | N |
+-----------+---------------+------------+------------+
那么加上权限即可:
updatemysql.userset Grant_priv='Y',Super_priv='Y'where user ='root'and host ='%';
flush privileges;
用 MySQL 很久了,再一次记录一些问题
The text was updated successfully, but these errors were encountered: