In the previous chapter, we added a global configuration file and configuration files per module. In order to be able to connect to a database, we need to add some lines to our configuration file first.
Let's recall our directory structure:

In order to connect to a database, we need to create it. Create a database named learning_phalcon
. You can do this quickly with the help of the following command line:
$ mysql -u YOURUSERNAME -p -e 'create database learning_phalcon;'
Open the global configuration file (config/config.php
), and add these lines:
'database' => array( 'adapter' => 'Mysql', 'host' => 'localhost', 'username' => 'Input your username here', 'password' => 'Input your password here', 'dbname' => 'learning_phalcon', ),
Now that we have the configuration parameters for our database, we must create a service. Open the global services file (config
/service.php
) and add the following lines...