【mysql】linux, mac mysql数据库root 密码忘记修改

首先关闭正在运行的mysqld进程

  1. 执行mysqld_safe --skips-grant-tables & 
  2. 双击enter 键进入命令行模式
  3. 执行 mysql
  4. linux 系统执行:update mysql.user set password = password('root') where user = 'root' and host = 'localhost';
  5. mac 系统执行:update mysql.user set authentication_string=password('root') where user = 'root' and host = 'localhost';
  6. 刷新权限:flush privileges;
  7. 退出:quit
  8. 杀死mysqld进程,然后重新连接 :mysql -uroot -proot 
  9. 完成
posted @ 2018-09-21 09:41  Flint99  阅读(126)  评论(0编辑  收藏  举报