Laravel 5 Basic CRUD Application – Part 2 (Setup)

Laravel 5 Basic CRUD Application – Part 1

In part 1 we have seen that how to install laravel.

Now we have mycrud directory in ‘/var/www/html/’ directory.

Now we are going to setup database for laravel. To do this you have to setup the db name and user name, password in the env file. This env file located in laravel root directory. In our example the file is in ‘/var/www/html/mycrud/.env’

“Note: the .env file is hidden. So make sure that you have viewing hidden files. If no means just press

“CTRS + H” to view hidden files. And if you don’t have hidden files means just simply copy and paste .env.example file and rename it to .env.

Now edit the .env file, you can see the following lines in the file.

DB_HOST=localhost //Host 
DB_DATABASE=mycrud //DB name 
DB_USERNAME=root //Username 
DB_PASSWORD=root //Password 

The Default database for Larvel is MySql. If you are not using mysql means just mycrud/config/database.php file and find the below line

'default' => 'mysql',

Change mysql into whatever you want. If you don’t know about the database list means you can scroll down the database.php file, now you can see ‘connections‘ array. Inside of connections array you can see databases list with configuration.

That’s all. The basic setup for laravel is completed. See you in Part 3.

With Regards,
Praveen Srinivasan


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s