How to connect to a database in xampp with Laravel project

Laravel connect to xampp database

Posted by Luke Beeno on July 4, 2022

How to connect to a database in xampp with Laravel project

Laravel connect to xampp database

Posted by Luke Beeno on July 4, 2022

If you have not yet set up your Laravel project on an Xampp stack, please go here https://wecode101.com/xampp-development-environment-for-laravel-8.

Step 1 Start up the xampp serve

Launch your control panel and click start on Apache and MySQL modules

Step 2. create database in phpMyAdmin

Once Apache and MySql as started successfully open a browser such as chrome, copy and paste the url "http://localhost/dashboard/" then click on the phpMyAdmin tab. You should see the phpMyAdmin panel, click on the database tab in order to create a new database.

Step 3. Configure .env file to connect with Xampp database.

Go to your .env file located at the root of your project and edit the database section as below:

Change the thexamppdatabasename to whatever you called the database in step 2.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=thexamppdatabasename
DB_USERNAME=root
DB_PASSWORD=

 

This field is required
Your question have been successfully submitted and will be reviewed before published
Please login to ask a question