Find us on facebook

Apr 26, 2015

[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (usin g password: YES) - Error

[PDOException]
  SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (usin
  g password: YES)

If above error comes when you run D:\wamp\www\laravel\BATransfer>php artisan migrate
command, That means you have not configured .env file at root directory. There you need to set

DB_HOST=localhost
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

and save it. Then run the above command in CLI. Tables will be created.

Installing Composer And Installing Laravel 5 (Method 2)

Download composer to any location you want. You can use following command.

D:\wamp\www>php -r "readfile('https://getcomposer.org/installer');" | php -- --i
nstall-dir=composer

Composer is a directory under www folder. We are going to install composer into that directory.

Following screenshot will give you more detailed idea.


After doing this process you will see that you have composer.phar inside the composer folder.

To install laravel use the following command and hit enter.

D:\wamp\www\composer>php composer.phar create-project laravel/laravel D:/wamp/www/laravel

/BATransfer123 --prefer-dist

Following screenshot will provide more details.


You are Done. :D

Installing Composer And Installing Laravel 5

Installing Composer

Before you install you need to enable php_openssl in php.ini file. Normally if you enable this on WAMP server,


It will uncomment php_openssl in D:/wamp/bin/apache/apache2.2.22/bin/php.ini file. But we need to uncomment D:/wamp/bin/php/php5.4.3/php.ini file to install composer. So manually uncomment the line extension=php_openssl.dll

Then;

You can download composer for windows from following link
https://getcomposer.org/download/
Under Windows Installer click on Composer-Setup.exe to download and then run.

Or you can use following command in CLI
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

To run php command under any folder in CLI you need to set environment variable. (PHP exe file path)
Eg: D:\wamp\bin\php\php5.4.3

Then restart the computer and open cmd, Then just type php and check.

C:\>php (If no error message displays, then your environment variable has set.

To check whether composer installed correctly you can type just "composer" and hit enter.(You need to go to composer installed folder)

Detailed screenshot shown below.


Installing Laravel 5

Now you have installed composer. Now create folder called laravel (Or any name) under www root folder and in cmd go to the location you have installed the composer and type following command and hit enter. It will create laravel 5 project called BATransfer (Instead this name you can use any name you prefer for your project)

C:\ProgramData\ComposerSetup\bin>composer create-project laravel/laravel D:/wamp
/www/laravel/BATransfer --prefer-dist

You can see detailed screenshot below.


After you install laravel successfully, You can see following folder structure under your directory.


You can access your laravel home page through following URL in localhost.

http://localhost/laravel/BATransfer/public/

That's all :D