$ /Applications/xampp/xamppfiles/bin/mysqladmin -u root -p password ‘wwxxyyzz’ ([Enter])
Enter password: ([Enter])
と入力すると
connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)'
とエラーが出る。調べてみると、パスワードをすでに設定しているのに何も入力していないから怒られているみたい。一度もパスワードを設定した記憶はないのに。。。
どうしようもないみたいなので、パスワードを再設定することにした。
手順は公式ページの一番下の方法を参考にしました。
【公式ページの引用】
Stop mysqld and restart it with the
--skip-grant-tables --user=root
options (Windows users omit the --user=root
portion).
Connect to the mysqld server with this command:
shell> mysql -u root
Issue the following statements in the mysql client:
mysql>UPDATE mysql.user SET Password=PASSWORD('
->newpwd
')WHERE User='root';
mysql>FLUSH PRIVILEGES;
Replace 「
newpwd
」 with the actual root
password that you want to use.
You should be able to connect using the new password.
【手順の説明】
- まず、mysqldを停止する。停止方法は過去エントリを参照。次に、ターミナルから、mysqldをオプションつきで再起動する。($ /Applications/XAMPP/xamppfiles/sbin/mysqld --skip-grant-tables --user=root)すると、[warning]とか色々出てきてターミナルが止まる(というか、コマンド入力しても反応しなくなる)。
- 新しいターミナルを起動し、コマンドラインからmysqlに接続する。($ /Applications/XAMPP/xamppfiles/bin/mysql -u root)
- 公式ページのコマンドをそのまま入力し実行する。
これで、新しいパスワードを使えばmysqlにログインすることができるようになる。
0 件のコメント:
コメントを投稿