Mysqlパスワードが失われました
作業環境 Razvian OS MariaDB(Mysql) mysql Ver 15.1 Distrib 10.3.29-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2 MariaDBを使う時パスワードを忘れました.
パスワードが入力されていない場合
パスワードが間違っている場合
そのため、パスワードをリセットする必要があります. mysqld停止
このときpasswordは現在ログインしているuser(pi)のパスワードです.
死んだと見せびらかす Mysql環境変数の設定
パスワードなしでアクセスできるように環境変数を設定します.
Mysql を再起動
パスワードを再設定します.
mysqlを終了したら、さっき設定した環境変数を再削除します.
が設定されているかどうかを確認します.
パスワードが入力されていない場合
mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)パスワードが間違っている場合
mysql -uroot -p
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)そのため、パスワードをリセットする必要があります.
systemctl stop mysqld
systemctl status mysqld

このときpasswordは現在ログインしているuser(pi)のパスワードです.

死んだと見せびらかす
パスワードなしでアクセスできるように環境変数を設定します.
sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

systemctl start mysqld
mysql -u root -p


mysql> UPDATE mysql.user SET authentication_string = PASSWORD("dufTlagltkfwk2)2)!!") WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;

systemctl stop mysqld
systemctl unset-environment MYSQLD_OPTS
systemctl start mysqld


Reference
この問題について(Mysqlパスワードが失われました), 我々は、より多くの情報をここで見つけました https://velog.io/@dogakday/리눅스-Mysql-비밀번호-분실テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol