That error indicates that your PHP page is attempting to connect to a database server running on the local host through a Unix socket.
MySQL databases at Dreamhost are hosted on separate machines to the web server. You need to connect using a server name, username and password, e.g:
$db = mysql_connect('mysql.uiv2.com', 'username', 'password');
Replace mysql.uiv2.com with the hostname you setup for your database in the panel.