129
132

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.

Mysqlのrootユーザのpasswordを初期化(変更)する

Posted at

Mysqlのrootユーザのpasswordを変更する

  1. mysqld_safeの場所を探し、skip-grant-tablesで起動します。普通のmysqldプロセスはstopかkillしておいてください。
$ mysql.server stop
$ /usr/local/bin/mysqld_safe --skip-grant-tables

140915 11:19:49 mysqld_safe Logging to '/usr/local/var/mysql/SPICE.local.err'.
140915 11:19:49 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
  1. パスワード不要でrootログインができるようになります。
$ mysql -u root
  1. 新しいパスワードに変更し、FLUSHします。
UPDATE mysql.user SET Password=PASSWORD('new password') WHERE User='root';
FLUSH PRIVILEGES;
  1. mysqldを再起動します。
$ mysql.server restart
129
132
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
129
132

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?