发现网上很多帖子都是互相抄袭的,关键是不能解决执行后的问题,在这里分享我的解决方案。
[En]
Found a lot of posts on the Internet are copied each other, the key is not to solve the problem after implementation, here to share my solution.
问题就是 Navicat连接时报错
然后再服务器上设置mysql密码报错
其实这个问题很简单:
show databases;
show tables;
执行后会发现有个user 表;
select host,user from user;
第一行host是我自己添加的,最下面一行是一开始就有的root账户,可以直接把user表的root账户对应的host改为’%’就可以在Navicat上远程登录了,就是SQL的update语句,不用搞得那么复杂
update user set host = '%' where host = 'localhost' and user = 'root';
再次检查,发现更新已成功。
[En]
Check again and find that the update has been successful.
最近需要执行flush privileges;
flush privileges;
然后Navicat就连接成功了
Original: https://www.cnblogs.com/tianyuwohu/p/15720786.html
Author: 一方玩
Title: ERROR 1396 (HY000): Operation ALTER USER failed for ‘root’@’localhost’
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/507932/
转载文章受原作者版权保护。转载请注明原作者出处!