Use the following steps to reset a MySQL root password by using the command line(Terminal).
Linux Debian & Rpm Package Support
Step 1:
Debian:
sudo /etc/init.d/mysql stop
Rpm: sudo /etc/init.d/mysqld stop
Step 2:
Start MySQL without a password sudo mysqld_safe --skip-grant-tables &
Step 3:
Connect to MySQL mysql -u root
Step 4:
Run the Command: use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit
Start and Stop Mysql Service
Debian:
sudo /etc/init.d/mysql stopsudo /etc/init.d/mysql start
Rpm:
Step 6:sudo /etc/init.d/mysqld stopsudo /etc/init.d/mysqld start
Login Mysql database Using root Password..
mysql -u root -p
0 Comments