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 🙂