I needed to use the servername rather than localhost. Otherwise I got the "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)" error.
If you tell SMF "localhost" is the server name, it will look for a mySQL server on the local computer ;)