I will answer this for both MS SQL as well as My SQL (just to make sure I am covering both basis)
1.Open a command prompt window by selecting "Start"-->"Run...", and typing "cmd.exe" in the "Run" dialog box.
2.Change to the directory in which the MSSQL or MSDE utilities are stored (this is usually C:MSDEbinn, C:Program FilesMSSQLbinn, etc.).
3.Type the following command where is the password you have chosen:
osql -U sa -P "" -Q "sp_password NULL,<newpassword>,sa"
First stop mysql from running ( service mysqld stop )
Then run mysql safe . . .
mysql --user=root mysql
then use the following command:
update user set Password=PASSWORD('new-password') where user='root';
and finally restart mysql again
Hope that helps no matter which DB system your using :-)