Dreamfactory not reading /databases/database.config.php


#1

I ran a clean install on Debian 8. Per Dreamfactory wiki instructions and then modified the /databases/database.config.php file to connect to a remote mysql database where I pre-created the dreamfactory (empty) database and username/pw combo. The Dreamfactory log (web.mysite.log) shows that it keeps trying to connect as dsp_user@localhost. The logged error is,

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

This even though my database.config.php file specifies a totally different db connection string and username (not dsp_user.) such as,

return array(
‘connectionString’ => ‘mysql:host=24.123.123.134;port=3306;dbname=dreamfactory’,
‘username’ => ‘someusername’,
‘password’ => ‘somepassword’,
‘emulatePrepare’ => true,
‘charset’ => ‘utf8’,
‘enableProfiling’ => defined( ‘YII_DEBUG’ ),
‘enableParamLogging’ => defined( ‘YII_DEBUG’ ),
‘schemaCachingDuration’ => 3600,
);

I tried restarting the server to no avail. The only way I can get Dreamfactory to run is to locally install mysql server and mysql client and use the default settings. It will not log trying to connect to the mysql server specified in the config, and that mysql server logs no login attempts (there is no traffic.)

I am sure the remote database is reachable as I can configure Dreamfactory to serve it as a REST API and I can also telnet to it from the Dreamfactory instance.


#2

You need to copy config/databases/database.config.php-dist to /config/databse.config.php

If it’s not in the config directory DreamFactory will continue to attempt the default credentials.


#3

@drewpearce
Thanks, I had put the config file in the /databases/ subdirectory, not the parent directory. I copied it to the parent directory /opt/dreamfactory/platform/ and now it works.


#4

@wayzel How did you setup remote mysql db as DF db? can you explain the steps a bit. i’m trying to use remote sql server db but its not working. I get HTTP 500 error. I edited config/database.php with following-

'default' => 'df2',
    'df2' => [
                'driver'   => 'sqlsrv',
                'host'     => '10.20.0.1',
                'port'        => '1433',
                'database' => 'bitnamidb',
                'username' => 'user',
                'password' => 'user@4562'    ]

#5

how did you setup remote DB as your DF DB ?
I am stuck


#6

in DF 1, this was done by copying config/databases/databse.config.php-dist to config/database.config.php

in DF 2, you need to edit the .env file in the root of the installation.
Supported database types are SQLite, MySQL, and Postgres.