« ワードプレスのSSL化で無限ループちゃん | メイン | hosts.allow日本のみ »

2019年09月16日

mysqlパスワード忘れ

systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld

mysql -u root

UPDATE mysql.user SET authentication_string = PASSWORD('newpass') WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
quit;

systemctl stop mysqld
systemctl unset-environment MYSQLD_OPTS
systemctl start mysqld

投稿者 muuming : 2019年09月16日 18:26