Usually I just bung in 127 or localhost in order to connect up to my DB. However, if you aren’t allowing remote connections, then running on a unix socket is much faster and skips all the networking overhead involved with TCP/IP.
So! To use a socket, you use a DSN for the connection. I’ve done this a few times, but I keep forgetting the syntax, sop here it is, solely for my own memory’s sake:
If you checked my last post, you will have read about how to get all your old ZF1 classes autoloading in your new shiny ZF2 project. However, the DB settings from your application.ini won’t have been set, and so you’ll get a 500 response with No Db Adapter. Not a problem. We just create the db adapter ourselves and tell Zend_Db that it is the default.
I’ve put this in the ZF2 index.php just before the last line, Zend\Mvc\Application::init($appConfig)->run();
//Set up ZF1 DB
$params = array(
'host' => '127.0.0.1',
'username' => 'xxx',
'password' => 'xxx',
'dbname' => 'xxx'
$adapter = Zend_Db::factory('Pdo_Mysql',$params);
Now your autoloading ZF1 DB classes wont freak out, and should connect no problem!