MySQL(オラクルインストール版) rootのパスワードをリセット(M1)

MySQLのサーバー停止後

sudo mysqld_safe --skip-grant-tables


別ターミナルを立ち上げて

mysql -u root
UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;
exit;


MySQLのサーバーを再起動して (オラクルインストール版の場合mysql.serverコマンドはアクセスできないため、システム環境から再起動する)

mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';


create user admin@localhost identified by 'yourpasswd';

//参考URL
https://gist.github.com/zubaer-ahammed/c81c9a0e37adc1cb9a6cdc61c4190f52