If you are getting an error "Can't assign requested address" you may have a problem with the mysql port. I had just moved my server to a MacMini running Mac OS X 10.6 and mysql_connect was giving this error. Going into the /etc/php.ini file and setting the default port number to 3306 fixed the problem.
mysql.default_port = 3306
The php.ini file suggests that PHP will select the port by using the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services, but in this case it is not so. /etc/services on my machine has 3306 listed, but it didn't get picked up.