Easy Way to Reset MYSQL Root Password for Linux User
Stop the MySQL service
Run the following command
For Ubuntu and Debian Users
sudo /etc/init.d/mysql stop
For CentOS, Fedora, and Red Hat Enterprise Linux Users
sudo /etc/init.d/mysqld stop
Now Start MySQL without a password
Run the following command
sudo mysqld_safe --skip-grant-tables &
Connect to MySQL
mysql -uroot
Set a new MySQL root password
use mysql;
update user set password=PASSWORD("yournewpassword") where User='root';
flush privileges;
quit
Run the following command to Stop and start the MySQL service
For Ubuntu and Debian Users
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
For CentOS, Fedora, and Red Hat Enterprise Linux Users
sudo /etc/init.d/mysqld stop
sudo /etc/init.d/mysqld start
0 Comments