I'm not sure about what the drupal script does, but it seems to assume it has access to /tmp/mysql.sock, which it doesn't. In the thread you linked to, /tmp is accessible, but the file checked (mysql.sock) is just a symlink to another place:
The problem there was that the user couldn't access...