Have you ever been in a rush or just had a complete brain freeze with your MySQL passwords?
Well…..I have. 🙂
——————————-
Step # 1 : Stop mysql service
SHELL> /etc/init.d/mysql stop
——————————-
Step # 2: Start to MySQL server w/o password:
SHELL> mysqld_safe --skip-grant-tables &
——————————-
Step # 3: Connect to mysql server using mysql client and setup the new root password:
SHELL> mysql -u rootmysql> use mysql; mysql> update user set password=PASSWORD("$PASSWORD") where User='root'; mysql> flush privileges; mysql> quit
——————————-
Step #4: Stop and Restart MySQL Server: (try your new $PASSWORD)
SHELL> /etc/init.d/mysql stop SHELL> /etc/init.d/mysql start SHELL> mysql -u root -p
——————————-
Note: There are other ways to reset the password, but I like this one.
Be First to Comment