After seeing all the database types that Zend Framework 2 supports, we can finally start connecting to them. In this recipe, we will connect to a MySQL server and show different ways of doing this.
To make full of the following recipe, a Zend Framework 2 skeleton application should be used, with a MySQL server available to connect to. Don't forget that connecting to a MySQL server requires the
mysqli extensions enabled in PHP.
In this recipe we'll give some examples of how to connect to a single database or multiple databases.
We can make the following change to the
<?php return array( // Set up the ...