1. 程式人生 > >【mysql】linux, mac mysql數據庫root 密碼忘記修改

【mysql】linux, mac mysql數據庫root 密碼忘記修改

linux 密碼忘記 safe update ges enter flush mysql 模式

首先關閉正在運行的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. 完成

【mysql】linux, mac mysql數據庫root 密碼忘記修改