Arturito.net

Come to The Dark Side, We Have Cookies!

Resetting Forgotten Mysql Password on Debian/Ubuntu

without comments

Debian:
1.Log in as root

2.root@deathstar:~# /etc/init.d/mysql stop

3.mysqld_safe –skip-grant-tables &
[1] 5216
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[5253]: started

4. root@deathstar:~$ mysql –user=root mysql
Enter password:

6. Hit enter :-)

5. mysql> update user set Password=PASSWORD(‘new-password-here’) WHERE User=’root’;

Query OK, 2 rows affected (0.04 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye

5. /etc/init.d/mysql restart

Ubuntu:

Repeat all steps with command sudo

artur@tatooine:~# sudo /etc/init.d/mysql stop

[sudo] password for artur:

etc.

mysql

Written by guru

April 7th, 2008 at 12:38 pm

Posted in Linux