LoginSignup
10
10

More than 5 years have passed since last update.

MySQLのルートパスワードを初期化する方法

Last updated at Posted at 2014-08-02

よくやっちゃうアレです。

rootになる。

$ sudo su -

mysqldを停止する。

# /etc/init.d/mysql stop

セーフモードで起動する。

# /usr/bin/mysqld_safe --user=root --skip-grant-tables &

MySQLにログインする。

# mysql -u root mysql

ルートパスワードを再設定する。

mysql> update user set Password=PASSWORD('newpassword') where User='root';
mysql> FLUSH PRIVILEGES;

mysqldを再起動する。

# /etc/init.d/mysql restart

完了ー。

参考リンク

MySQL :: MySQL 4.1 リファレンスマニュアル :: A.4.2 忘れたルートパスワードをリセットする方法

10
10
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
10
10