Opening a db connection in a cron job

I’m getting this error when connecting to a database through a cron job.
[php]Warning: mysql_connect(): Access denied for user ‘[username]’@‘’ (using password: YES)[/php] is not my site.

Can anyone offer some guidance here?

Thank you Michael

might need to post a bit more of your cron job…