Forgot the MySQL root user password on Mac OS X system and need to reset.

1036 ワード

Have you forgotten your Mac OS X 'ROOT' password and need to reset it? Follow these 4 simple steps:MySQLのルートユーザーのログインパスワードを忘れましたか?パスワードのリセットは、次の4つのポイントから行えます.
  • Stop the mysqld server. Typically this can be done by from'System Prefrences'>MySQL>'Stop MySQL Server'(設定でMySQLが実行するサービスをオフにしておく)
  • Start the server in safe mode with privilege bypass From a terminal:(端末では以下のコマンドを使用してセキュリティモードを使用してMySQLサービスを開く)
  • sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
    
  • In a new terminal window:(さっきの端末は無視して、新しい端末ウィンドウを再開して、次のコマンドを入力します)
  •  a). sudo /usr/local/mysql/bin/mysql -u root
    

    (次のコマンドでは、NewPasswordを自分のパスワードに置き換えます)
      b). UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE user='root'
    
    c). FLUSH PRIVILEGES
    
    d). \q
    
  • Stop the mysqld server again and restart it in normal mode. (設定でMySQLが実行しているサービスを再度オフにし、サービスをオンにします)