Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Tutorials»Magento 2 Database Configuration File

    Magento 2 Database Configuration File

    RahulBy RahulMarch 8, 20161 Min ReadUpdated: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.

    Magento magento2
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Create, List & Delete Docker Containers on Linux
    Next Article How to Install Nginx SSL Certificate

    Related Posts

    (Resolved) userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms

    Updated:May 10, 20221 Min Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    How To Enable SSH Server on Ubuntu 22.04

    Updated:April 22, 20222 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    10 Best Linux Video Players in 2022

    Updated:February 18, 20226 Mins Read

    How to Switch Python Version in Ubuntu & Debian

    Updated:April 22, 20223 Mins Read

    4 Comments

    1. gomage on June 11, 2019 7:42 pm

      Thanks for sharing all of your experiences!

      Reply
    2. Deepak on March 26, 2019 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

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

      thanks

      Reply
    4. anpel on August 20, 2016 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

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.