How to change the Database for Magento 2.0?

To change the Admin Path for Magento, please open up the file below:-
/app/etc/env.php

Look for the following:-
'db' => 
  array (
    'table_prefix' => '',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => 'localhost',
        'dbname' => 'DB_NAME',
        'username' => 'DB_USERNAME',
        'password' => 'DBPASSWORD',
        'active' => '1',
      ),
    ),
  ),

Change DB_NAME, DB_USERNAME and DBPASSWORD to the new MySQL Database that you want to use. 


Was this answer helpful?

 Print this Article

Also Read

How to change the Admin Path for Magento 2.0?

To change the Admin Path for Magento, please open up the file below:- /app/etc/env.php Look for...

What PHP version to use for Magento 2?

The best PHP version to use for Magento 2 (for now) is PHP 5.6. If you are using our Web Hosting...

Broken Images / CSS or "Forbidden: PHP engine is disable" in Magento 2.0

If you see the error "Forbidden: PHP engine is disable." or a page without images or CSS after...

Issue when switching to Production mode in Magento 2

When trying to switch from Developer mode to Production mode:- php bin/magento deploy:mode:set...

How do I set the correct file permissions for Magento?

Magento installation out of the box does not use the correct and safe file permissions for our...