How to Change database details in Magento 2


You can do this easily 🙂

Go to app folder > Etc > and open env.php

In this file, you can find below code section

array (
'host' => 'localhost',
'dbname' => 'magento2',
'username' => 'root',
'password' => '',
'model' => 'mysql4',
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
),

Edit the details and add your database information.

That’s it 🙂

S.S.Niranga

Senior Tech Lead at Netstarter PTY ltd. Magento Certified Front End Developer, Certified ScrumMaster, Microsoft Certified Professional, Member of British Computer Society

Leave a Reply

  • (will not be published)