Environment: Mac Laravel 6.x series Mariadb
The following error is displayed when executing php artisan migrate.
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known (SQL: select * from information_schema.tables where table_schema = database and table_name = migrations and table_type = 'BASE TABLE')
When I copied and pasted a part of the above error message and searched, the countermeasure for ".env file" correction came out, but In my case, all of them were already set, so I couldn't solve it. After that, I continued to search and finally solved it, so as a memorandum. As a result, it was a very rudimentary mistake. .. ..
The following is a simple flow. ① Enter the container ② Execute "php artisan migrate" in the container ③ A different error message is displayed ④ Check and correct the content of the error message
==================================
① Enter the container
$ docker-compose exec app bash
② Execute "php artisan migrate" in the container
[app] php artisan migrate
③ A different error message is displayed Probably, the contents that are pointed out such as description mistakes will be displayed.
④ Check and correct the content of the error message Read the error message displayed in ③ and correct the target file.
My example: "255" is mentioned in the error message. The cause was that the table was created in the migration file as follows. After the fix, I was able to migrate php artisan without any problems. .. ..
#Incorrect (not necessary because it is 255 by default)
$table->string('title',255);
#Revised
$table->string('title');
It's an embarrassing mistake, but I hope this helps someone! !! !! !! !! !!