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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -