I will answer this for both MS SQL as well as My SQL (just to make sure I am covering both basis)
Microsoft SQL
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"
MySQL
First stop mysql from running ( service mysqld stop )
Then run mysql safe . . .
mysqld_safe --skip-grant-tables
then
mysql --user=root mysql
then use the following command:
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
and finally restart mysql again
Hope that helps no matter which DB system your using :-)