Install Laravel
Open the terminal and type the following command. Note that the last word represents the name of the Laravel Project in this command.
composer create-project laravel/laravel livewire_practice
Wait for the above command to complete the process. You will see a new directory with the project name in the present working directory. So, you need to go to this directory using the command below.
cd livewire_practice
Create and Configure MySQL Database
As we have set up MySQL in the previous section of the article. Now, we need to create a database for our project. For this, follow the steps below.
Log in to MySQL as the root user.
mysql -u root
Run the following command to create a new database.
CREATE DATABASE testdb;
You can verify/view the database by the command below.
SHOW DATABASES;
Exit
exit
Now, we need to add the database in the environment configuration file (.env) of our Laravel Project we created in the previous section.
Add database name in .env
Open the project directory livewire_practice and edit the .env
file. Assign the key DB_DATABASE the name of the database we have created testdb.
DB_DATABASE="testdb"
Save the .env
file and move to the next lesson.