Forums: Recover Mysql Root Password - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Recover Mysql Root Password within 10 minutes (applies to Debian)

#1 User is offline   HenrikHansen 

  • Private
  • Icon
  • Group: Members
  • Posts: 3
  • Joined: 13-January 08

Posted 22 September 2009 - 05:33 AM

Ever tried losing your MySQL root password, because you’re an idiot or a coworker changed it without documenting or telling?

Well, within 10 minutes this can be fixed. This guide applies to Debian and probably others too. su - to root and perform the following.

1. Stop MySQL
/etc/init.d/mysql stop


2. Start MySQL and skip grant tables, put it to background so you can work
mysqld_safe –skip-grant-tables &


3. Enter MySQL as root
mysql -u root


4. Change the password within the MySQL console
mysql> use mysql;
mysql> update user set password=PASSWORD(”insert-new-password-here”) where User=’root’;
mysql> flush privileges;
mysql> quit


5. Stop MySQL server again
/etc/init.d/mysql stop

- Now if that did not work, find the MySQL process with ps and kill it.


6. Start MySQL again
/etc/init.d/mysql start


And it should work.. test it by typing “mysql -u root -p” and enter the password you just created.
0

#2 User is offline   bl00db1tz 

  • Private
  • Icon
  • Group: Members
  • Posts: 5
  • Joined: 21-October 09

Posted 07 November 2009 - 07:52 PM

good ;)


EDIT: Warned. No one liners. Read the rules.
webDEViL

0

#3 User is offline   illwill 

  • Master Sergeant
  • Icon
  • Group: Members
  • Posts: 540
  • Joined: 28-July 03

Posted 07 November 2009 - 11:53 PM

http://www.whatsmypa...-password-reset
i put on my blog last year to help remember the commands when i needed them


for mssql 2k5 use this
http://www.whatsmypa...-command-prompt
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting