MySQL使用root用户授权出现错误ERROR 1045 (28000) at line 2: Access denied for user 'root'@'%' (using password: YES)解决办法

  参考:https://blog.csdn.net/open_data/article/details/42873827

  使用MySQL的root用户登录出现错误提示

  ERROR 1045 (28000) at line 2: Access denied for user 'root'@'%' (using password: YES)

  查看授权表信息,会发现grant权限后面是‘N’

select * from mysql.user\G

  但是本地登录的root用户有权限

  解决办法家socket使用localhost登录即可正常授权

mysql -uroot -p -hlocalhost --socket=/tmp/mysql3306.sock

  查找本地socket的命令

ps -ef|grep 3306|grep "socket"|awk -vRS="--socket" '{t=$0;}END{print "--socket"t}'|awk '{print $1}'

  也可以把root@'%'用户重新授权

grant all on *.* to root@'%' identified by 'test123456' with grant option;

  

猜你喜欢

转载自www.cnblogs.com/minseo/p/10291254.html
今日推荐