LoginSignup
0
0

More than 3 years have passed since last update.

MySQLのパスワードを変更する

Posted at

前提

Railsアプリを作っていた時にMySQLに入れなくなってしまった(rootの初期パスがあった?)ため下記のエラーで詰まった話

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

準備

セーフモードでMySQLを起動

mysqld_safe --skip-grant-tables &

プロセスの確認(mysqld_safe A mysqld process already exists)だったらkillする

ps -ef | grep mysql

別ターミナルを立ち上げてmysql -u rootでサーバーに入る

パスワード変更

mysql > USE mysql;
mysql > ALTER USER 'root'@'localhost' identified BY 'hogehoge';

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0