LoginSignup
23
24

More than 5 years have passed since last update.

MySQLでrootのパスワードを忘れた場合(CentOS)

Last updated at Posted at 2014-08-20

1. まずはMySQLを停止

$ sudo service mysqld stop

2. MySQLをセーフモードで起動

$ mysqld_safe --skip-grant-tables &

3. root でログイン

$ mysql -u root

4. パスワードの再設定

> use mysql;
> update user set password=PASSWORD("新パスワード") where User='root';
> flush privileges;
> quit

5. セーフモードのMySQLを停止

$ sudo service mysqld stop

6. 通常モードでMySQLを起動

$ sudo service mysqld start
23
24
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
23
24