改表法:把host地址改为%

   use mysql;
  update user set host = '%' where user = 'root'and host="127.0.0.1" ;
FLUSH PRIVILEGES;

2、重新建立一个用户

  1、把原user表导出一份来

 mysqldump -w"User='root'" -uroot -p mysql user>/home/jksong/user.sql 

  2、修复其中的一条为 User='jksong' , Host='%', 然后插入user表, 不能复用下面的sql,不同版本sql可能会不同

INSERT INTO `user` VALUES ('%','jksong','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);

  3、执行

FLUSH   PRIVILEGES;

修改密码:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
update user set password=password("520") where user="root";

最新文章

  1. JAVA 设计模式 模板方法模式
  2. django rest framework
  3. Oracle分页语句
  4. 每天一个 Linux 命令(5):rm 命令
  5. javascript的原型与继承(2)
  6. log4j使用教程详解(怎么使用log4j2)
  7. hdu1024 Max Sum Plus Plus
  8. 【字符串处理】HDOJ-1020-Encoding
  9. 由C到C++的学习 ----Essential C++
  10. SGU 171.Sarov zones
  11. Swift - whose view is not in the window hierarchy 问题解决方法
  12. The application to execute does not exist: 'C:\Users\Administrator\.dotnet\tools\.store\dotnet-aspnet-codegenerator\2.2.0-rtm-35687\dotnet-aspnet-codegenerator\2.2.0-rtm-35687\tools\netcoreapp2.1\any\
  13. Altium designer 新建快捷键
  14. elasticsearch 集成springboot
  15. Web服务器之Nginx详解(理论部分)
  16. cmd 安装mysql
  17. 进程表示之进程ID号
  18. ES6-循环
  19. [UE4]使用蓝图关闭对象的碰撞SetActorEnableCollision
  20. java Enum 类型互转

热门文章

  1. 【8.17校内测试】【模拟】【set】【网络流】
  2. bzoj 2821 分块
  3. bzoj 3757 树上莫队
  4. bzoj 1303: [CQOI2009]中位数图 数学
  5. Codeforces Round #300 C. Tourist's Notes 水题
  6. zoj 1610 Count the Colors 线段树区间更新/暴力
  7. Unity Pivot/Center与Local/Global总结
  8. wampserver3.1.0安装及配置
  9. change kernel defconfig
  10. 利用Lucene与Nutch构建简单的全文搜索引擎