Connecting your laravel project to MySQL database is moderately easy. Since we have done the installation with XAMPP. It comes along with already installed MySQL and PHPMyAdmin. In this tutorial, I will make use of phpMyAdmin to create a new database that will connect to the laravel application. This post is assuming you already have a laravel project setup in your local and you are able to access its homepage via localhost or custom set domain name.
Step1: Create a new database via phpmyadmin
Navigate to domain name.dev/ PHPMyAdmin, Click on the Databases tab and create a new database with your wanted name.
Clicking on create will create a new database in your XAMPP MySQL.
Step2: Changes in.env configuration file
Once the database is created, you need to tell your laravel project the details about the database.
Laravel 5 has a pretty simple way to do that, All configuration that you should stay private and should not share goes into the .env file of your laravel project.DB_CONNECTION=mysql
DB_PORT=4008
DB_DATABASE=testProject
DB_USERNAME=root
DB_PASSWORD=Read more