Difference between revisions of "Resetting MySQL root password"
From Notes_Wiki
m |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Mariadb configuration|MariaDB configuration]] > [[Resetting MySQL root password]] | |||
In case we have root privileges on server and want to reset mysql root password then we can use following steps: | In case we have root privileges on server and want to reset mysql root password then we can use following steps: | ||
Line 40: | Line 39: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Mariadb configuration|MariaDB configuration]] > [[Resetting MySQL root password]] |
Latest revision as of 02:52, 5 March 2022
Home > CentOS > CentOS 6.x > MariaDB configuration > Resetting MySQL root password
In case we have root privileges on server and want to reset mysql root password then we can use following steps:
- Stop mysql service if it is running.
- service mysqld stop
- Use below command to run mysql without any priviledge information
- mysqld_safe --skip-grant-tables &
- Connect to mysql by without any options or authentication
- mysql
- Use database mysql using:
- use mysql
- Change root password using:
- update user set password=password('secret') where user='root'
- or disable it using:
- update user set password='' where user='root'
- Stop mysql using command:
- service mysqld stop
- This did not work in stopping mysql. Had to kill mysqld_safe and later mysql process to stop mysql.
- Start mysql again without any password or with the new password set.
Refer:
Home > CentOS > CentOS 6.x > MariaDB configuration > Resetting MySQL root password