Showing posts with label .env File. Show all posts
Showing posts with label .env File. Show all posts

Monday, 23 October 2017

How to change Laravel database configuration

How to change Laravel database configuration

When you move a project from local development to a live server, switch hosting providers, or connect to a new database, it's common to have to change the Laravel database settings. If you're using the Laravel framework, it's important to know how to change database settings correctly so that your development process goes smoothly. This SEO-friendly guide will show you how to safely and quickly change the configuration of your Laravel database step by step.

Step 1: Locate the .env File

Laravel uses a file called .env to manage the settings for an application. This file lets developers set values that are specific to each environment without changing the main codebase. The .env file is very important for setting up a database, whether you're working on a local server like XAMPP or deploying to a production server.

Go to the root directory of your Laravel project to change the database connection. Inside this directory, you will find the .env file. If you cannot see it, make sure hidden files are enabled in your file explorer or code editor.

The .env file has private configuration information like the database name, username, password, and host. Be careful with this file at all times, and never put it in public repositories.

.htaccess not working even though allowoverride is enabled

You're not the only one who has had the annoying problem with Apache where your file doesn't work even after you enable it. Who has ...