• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

Magento 2 Database Configuration File

Written by Rahul, Updated on October 28, 2020

Magento 2 is latest version available of the popular eCommerce software Magento. In previous tutorial you got details about Magento2 installation on Linux.

This tutorial will help you to update Magento 2 database configuration file. The previous Magento versions’ uses app/etc/local.xml database configuration file. The Magento2 keep database configuration under app/etc/env.php file.

Magento 2 Database Configuration File

To change your Magento 2 database server hostname, database username, password or database name, you need to edit below file.

/Magento2 Install Dir/app/etc/env.php

Navigate to your Magento 2 installation directory and edit app/etc/env.php configuration file in your favorite editor and search for following settings and do necessary changes.

  'db' =>
  array (
    'table_prefix' => '',
    'connection' =>
    array (
      'default' =>
      array (
        'host' => 'localhost',
        'dbname' => 'database_name',
        'username' => 'database_username',
        'password' => 'database_password',
        'active' => '1',
      ),
    ),
  ),

Now update the orange highlighted values as following

  • localhost : MySQL server hostname.
  • database_username : MySQL user to connect database server.
  • database_password : MySQL user password .
  • database_name : MySQL database name of magento.

Conclusion

In this tutorial, you have learned to update database configuration on Magento2 application.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

4 Comments

  1. Avatar gomage Reply
    June 11, 2019 at 7:42 pm

    Thanks for sharing all of your experiences!

  2. Avatar Deepak Reply
    March 26, 2019 at 9:47 am

    Hello Rahul,

    Using same way, can we connect 3rd party SOAP API’s ? Where my credentials are stored in env.php file and using that I will create on connection class like AbstractDB in default Magento2

  3. Avatar b Reply
    March 16, 2019 at 4:35 pm

    thanks

  4. Avatar anpel Reply
    August 20, 2016 at 8:13 pm

    Are the passwords in the file encrypted/hashed or are they just stored as plain text?

    I am trying to retrieve my password from the env.php file but it does not seem to be correct

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy