Try to change database name in zend

293 Views Asked by At

How to change database configuration in zend framework 2. Working on a old application when tried to edit database name in config/autoload/local.php it not given any error.I have change the

'db' => array(
            'driver' => 'Pdo',
            'dsn' => 'mysql:dbname=backend;host=localhost',
            'driver_option' => array(
                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
            ),
        ),

dsn but nothing happened.I am new on zend worked on codeigniter.I have change dsn dbname=new but still get connected with the old database.

1

There are 1 best solutions below

2
Ermenegildo On

More than likely, the configuration of your application is cached (which is a good thing in production environments, a bit less in development) and your changes doesn't affect anything because... cache!

If you need this in a development environment, I suggest you to disable the cache. Search into /config/application.config.php the keys config_cache_enabled and module_map_cache_enabled and set them to false.

If you just need a "one time cache refresh", then just clear the folder /data/cache. If this folder is already empty (or does not exists), search the key cache_dir in the /config/application.config.php. This options defines the path of the cache folder.