Trouble Configuring Password for MySQL

Hello friends,
im not that perfect in php yet. However, i encountered a problem: when i connected to database using this-
mysql_connect($localhost, $root, $password); i saw an error message that "access denied" and my [default] password is "yes". Please friends, how do i configure it so it runs without hitches.