A
A
Alexander Ivanov2018-02-09 13:09:41
Yii
Alexander Ivanov, 2018-02-09 13:09:41

How to connect to the database in YII first?

can't connect to db in YII
config:
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=samos23_avenudev',
'emulatePrepare' => true,
'username' => 'samos23_avenudev',
'password ' => 'qwerty1234567890',
'charset' => 'utf8',
'tablePrefix' => 'tbl_',
),

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2018-02-09
@ivankomolin

The config is visually correct, go on Yii::app()->db-> ...and on)
If it doesn’t work, look at the mysql server settings, namely:
1. Is it exactly listening to localhost port 3306
2. Is it exactly what the database is called
3. Is the connection data correct
In general, in order not to guess, it would be nice to turn on debug and see what exception is thrown when the database is accessed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question