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
Post a Comment