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_DATABASE=mycrud //DB name
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.