Mysql_connect error on php cron job

software development


I have a php script I want to run as a daily cron job.
It is designed to update a db from an rss feed (no, I’m not scraping - the source is happy with me doing it :-P)
The script runs just fine as a webpage, but when I run it from the command line as
(which matches
the mysql_connect fails with error

Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in /home/.jumper/myusername/domainshortname/myprogram.php on line 16

I am on webserver slice and mysql server ren
My mysql_connect call is
$idDatabase = mysql_connect(‘’, ‘username’, ‘password’);
this works fine from the web browser.
It looks like, from the command line, the program is trying to find the mysql socket on slice, which doesn’t exist.
how do I tell it to look on ren?
i’ve tried a hostname of and that gave the same error.
Any ideas?