PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, December 29, 2021

[FIXED] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

 December 29, 2021     laravel, laravel-5, migration, mysql, php     No comments   

Issue

I keep this while running php artisan migrate

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

My Environment

  • Laravel Framework version 5.1.20 (LTS)
  • Laravel Installer version 1.2.0
  • PHP 5.6.14 (cli) (built: Oct 2 2015 08:55:56)
  • mysql Ver 14.14 Distrib 5.6.24, for osx10.10 (x86_64)

.env file

APP_ENV=local
APP_URL=http://localhost/
APP_DEBUG=true
APP_KEY=****

DB_HOST=http://localhost/
DB_DATABASE=name-local
DB_USERNAME=root
DB_PASSWORD=
UNIX_SOCKET = /tmp/mysql.sock

That data-base name-local is exist in my local database.

Any hints / suggestions will be a huge help for me.


Solution

Check your DB_HOST on your .env file

DB_HOST=http://localhost/ --> DB_HOST=localhost


Result:

I can migrate peacefully now.

php artisan migrate
Migration table created successfully.
Migrated: 2014_10_12_000000_create_users_table


Answered By - code8888
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing