How to Reset MySQL Root Password in Linux
Resetting MySQL Root Password in Linux
Forgetting the root password of your MySQL database in Linux can be a common issue. However, you can easily reset it by following these steps:
- Stop the MySQL service using:
sudo systemctl stop mysql
- Start MySQL in safe mode:
sudo mysqld_safe --skip-grant-tables &
- Connect to MySQL as root:
mysql -u root
- Set a new password:
USE mysql; UPDATE user SET authentication_string=PASSWORD('new_password') WHERE User='root'; FLUSH PRIVILEGES; QUIT;
- Stop MySQL safe mode:
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown
- Start the MySQL service normally:
sudo systemctl start mysql
- Now, you can login to MySQL using the new password.
What is the password problem?
The password problem refers to the challenges and vulnerabilities associated with creating, managing, and securing passwords, which often leads to weak or reused passwords and increased security risks.
Generate strong passwords tool
Online web, mobile resources for generating strong passwords...
Did you find this page useful?