Skip to main content

Posts

Showing posts with the label password

Reset MySQL Root Password

Today, In this article we are going to learn how to “ Reset MySQL Root Password “. It is a good option to use this method only for resetting the password but it is highly insecure. So make sure after resetting the password, you also revert the changes from my.cnf file. Note: For Centos and Fedora Based OS sudo service mysqld stop sudo service mysqld start For Debian and Ubuntu OS sudo service mysql stop sudo service mysql start Steps Here i am using amazon linux 2 OS (based on centos) Stop mysql service – sudo service mysqld stop Open /etc/my.cnf file – sudo nano /etc/my.cnf Add skip-grant-tables under [mysqld] section Start MySql Service – sudo service mysqld start Open terminal and type mysql and type following query and press enter UPDATE mysql.user SET authentication_string=PASSWORD(‘Your new password’) WHERE User=’root’; Then write FLUSH PRIVILEGES; and press enter Now type – exit; Stop mysql service again – sudo service mysqld stop Open my.cnf file – sudo nano /etc/my.cnf