How to Install MySQL and Laravel framework in windows step by step

3 min read

In this tutorial, I’ll guide you through the installation of PHP and MySQL on Windows, and additionally how to set up the PHP framework Laravel and Composer with Git. PHP 5.4 and later versions have an inbuilt development server, so in this tutorial I won’t cover all the web server setup—just simple PHP and MySQL with Composer and the inbuilt development web server. Let’s get started.

Note: This tutorial references PHP 5.5, which is very outdated and no longer supported. For modern development, use PHP 8.1 or later. The installation process is similar, but you should download the latest PHP version.

Setup overview

  • PHP  ( Server Side Scripting Language )
  • MySQL ( Database )
  • Composer  ( Dependency manager )
  • Git  ( Version Control System )

Installation

PHP  :

Download PHP

Note: Download the latest PHP 8.x version for modern development. PHP 5.5 is no longer supported.

and extract the php file in ** C:\php  ** or anywhere just remember the location , after extracting the php lets setup windows PATH variable , so we can access php from CMD ( command prompt ) .  How to setup Environment Variable in windows : just simply follow the steps

  1. open My Computer and click on properties
    properties
    properties
  2.  click on advance system settings
    advance
    advance
  3. Click on the Environment Variables From System Properties window
    Windows system environment variables
    Windows system environment variables
  4. Choose System variables and select PATH and click edit
    edit
    edit
  5. Add  ”  ;  ” ( without quotes )  and add php location
    done
    done
  6. Click OK and OK again and Press_ Windows + R_ and type_ CMD_  and type  php -v
    php windows cmd
    php windows cmd
    if you are getting that kind of output  , Congrats now php is installed and accessible from CMD

MySQL :

Download MySQL

MySQL comes with windows installer but i will show you how to install using zip package . Download and extract zip in C:\MySQL  and setup environment variable exactly like how we did setup for PHP .

MySQL
MySQL
 Now secure the MySQL initial user account. See this guide: https://dev.mysql.com/doc/refman/8.0/en/default-privileges.html

Note: The documentation link has been updated to MySQL 8.0. The process is similar for all versions.

MySQL Service in windows
if you want to start mysql when you log on then install mysql service and select automatic start ,
click on start >>all programs >> accessories > then right click and open Command prompt as admin

cd  c:\mysql\bin
C:\MySQL\bin>mysqld --install

and now open service manager and find MySQL service then click on properties set automatic start

Mysql Service
Mysql Service

 Now PHP and MySQL are installed. Let's install Composer. Download the Windows installer and install it like another Windows package. Just choose the correct PHP location when installing.

Composer on windows
Composer on windows
open CMD and type ” composer –version ” and make sure it print version otherwise troubleshoot your installation  .

Laravel

Now let’s set up Laravel. Laravel is a PHP-based MVC framework. If you’re confused, it’s like ASP.NET MVC and Ruby on Rails framework, just written in PHP. Let’s install it. Open CMD and paste:

composer create-project laravel/laravel TestProject

wait for time it will take some time to install all the dependencies , if you are getting openssl error then simply open php.ini file and fix extension dir path ( see the php folder that we extracted at the time of installation )

extension_dir = C:\php\ext

and change

;extension=php_bz2.dll
//to 
extension=php_bz2.dll

then try again , i am sure it gonna work . now wait until it finish setting up dependencies .

laravel project
laravel project
after that lets start development  server  . open CMD cd to project root and laravel comes with a tool calle artisan lets fire up dev server using artisan
php artisan serve

then open browser and open http://localhost:8000 , and you will see default laravel page .

Some Important Links

  1. https://laravel.com
  2. https://www.php.net/docs.php
  3. https://laracasts.com/
  4. https://laravel.com/api


  • Home
  • About