Easy Way to Reset MYSQL Root Password for Linux User

 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

Refer: 

Comments

Popular posts from this blog

Install Dspace 7.2 on Ubuntu 22.04 LTS

How to delete library data in koha using the command line

Koha INSTALLATION

Total views