yii2 - Setting up a database for Yii 2 -


i need install app written in yii 2 on local computer. installed composer , initiated app with:

php /path/to/yii-application/init 

now need "create new database , adjust components['db'] configuration in common/config/main-local.php accordingly."

i have no clue how that.

1) create database on server.
2) open common/config/main-local.php

edit components to:

'components' => [     'db' => [         'class' => 'yii\db\connection',         'dsn' => 'mysql:host=localhost;dbname=database_name',         'username' => 'database_user',         'password' => 'database_password',         'charset' => 'utf8',     ], 

if using mamp mac edit dsn line :

'dsn' => 'mysql:unix_socket=/applications/mamp/tmp/mysql/mysql.sock;dbname=database_name' 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -