今天突然远程登录一下mysql发现,新建数据库时,出现Access denied for user ‘root‘@‘%to database ‘xxx‘
这是什么鬼,以前使用没有问题呀???
然后就csdn一下
首先到文本登录一下root用户账号
mysql -uroot -pxxxxx
重新给root%用户授权一下
grant all privileges on *.* to 'root'@'%' identified by 'xxx此处为密码xxx' with grant option;
执行发现,
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'root' with grant option' at line 1
我去,没有办法。从错误发现时从identified的地方开始报错的,那干脆省略算了
grant all privileges on *.* to 'root'@'%'
发现果然好使,然后接着刷新权限
flush privileges;
ok,解决
来源地址:https://blog.csdn.net/m0_58590712/article/details/132084799