Recover your MySQL password on Linux
Hello friends, In this opportunity, I want to share with us how to recover your MySQL password. For this, I am using Fedora 33 y MySQL Server 8. The steps are the following.
1.- Stop the MySQL service with the sudo systemctl stop mysqld command and verify its status with sudo systemctl status mysqld command
2.- Set the MYSQLD_OPTS environment variable with systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" command.
3.- Start MySQL server with the sudo systemctl start mysqld command and verify its status with sudo systemctl status mysqld command.
3.- Connect to MySQL Server as root with the mysql -u root command, execute the UPDATE mysql.user SET authentication_string=null WHERE User='root'; FLUSH PRIVILEGES; and exit.
4.- Connect to MySQL Server as root with the mysql -u root command, execute the ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'Test..2o22' and exit.
5.- Stop the server with the sudo systemctl stop mysqld command and unset the MYSQLD_OPTS environment variable with systemctl unset-environment MYSQLD_OPTS command.
6.- Start MySQL server with the sudo systemctl start mysqld command and verify its status with sudo systemctl status mysqld command.
7.- Finally, verify the change connecting to MySQL Server with the new password.
0 comentarios:
Publicar un comentario