9
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MariaDB(MySQL) パスワードリセット

Last updated at Posted at 2015-12-10

MySQL

セーフモードでの起動

service mysqld stop
→プログラムの停止

mysqld_safe --skip-grant-tables &
→セーフモードでの起動

mysql -u root
→rootでログイン(パスワードなし)

rootのパスワードをクリア

use mysql;
→mysqlデータベースを選択

update user set password=PASSWORD("") where User='root';
→rootアカウント全てのパスワードを空に設定

flush privileges;
→権限設定の反映

quit
→ログアウト

service mysqld stop
→プログラム(セーフモード)の停止
Shutting down MySQL..151204 14:21:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
 SUCCESS!

service mysqld start
→プログラム(通常モード)の起動

rootパスワードの設定

/usr/local/mysql/bin/mysql -u root -p
→パスワードなしでログインできること
再設定手順

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?