3

I want to use a MySQL database with my Laravel 5.2 framework. I'm not able to access phpMyAdmin after I run php artisan serve and open a localhost page.

My .env file :

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=people
DB_USERNAME=pftest
DB_PASSWORD="pftest_2016#9"

After doing this, I ran php artisan migrate and got the following error:

[PDOException] could not find driver 

Following which, I have installed the php-mysql extension and checked for its presence in php.ini file. But I'm still getting the following error :

[PDOException]  SQLSTATE[HY000] [2002] Connection refused

So what is the issue and how to solve it?

7
  • Check the password , "pftest_2016#9" or pftest_2016#9 ? Commented Jun 7, 2016 at 11:45
  • 1
    Run php --ini from the command line and make sure it is using the same .ini file you think it is using. Commented Jun 7, 2016 at 15:44
  • @kirangadhvi its not same.. read the error.. my error is : [PDOException] SQLSTATE[HY000] [2002] Connection refused Commented Jun 8, 2016 at 4:08
  • @Pitchinnate After I ran php --ini , I found the configuration file pointing at this place: /etc/php/7.0/cli/php.ini. Where is it suppose to point ?? how to know which path its suppose to point ?? Commented Jun 8, 2016 at 4:17
  • @s_user hey please check this link and check answer i think that's what you looking for. stackoverflow.com/questions/25329302/… Commented Jun 8, 2016 at 5:18

1 Answer 1

2

In the .env file, set

APP_ENV=local
DB_PORT=3306

and then run php artisian migrate --env="local"

Same is valid for dev,production env.

Sign up to request clarification or add additional context in comments.

1 Comment

artisian shoud be renamed to 'artisan'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.