Hi.
new to laravel I am doing one of the big tutorials at laracast. Its LAravel from Scratch by Jeffrey Way.
Now in the DB chapter we start using the eloquent DB, first. .And I fail.
Setup is a docker-compose with php / msyl container.
Both are up. Both reach each other.
I installed mysql-client on my php container.
Both users can - actually - create tables and databases from the PHP container.
That shows me, the connection is given and working.
But each artisan command fails.
Tried
php artisan migrate
php artisan migrate:install
php artisan migrate:fresh
Always Connection Refused.
application/env:
DB_CONNECTION=mysql
DB_HOST=lara-kurs-1-mysql
DB_PORT=23061
DB_DATABASE=blog
DB_USERNAME=root
docker-compose.yml
mysql:
container_name: lara-kurs-1-mysql
image: mysql:5.7
restart: on-failure
environment:
MYSQL_ROOT_USER: root
MYSQL_DATABASE: blog
MYSQL_USER: 'root'
MYSQL_PASSWORD: 'r00t'
ports:
- "23061:3306"
DB_PASSWORD=r00t
Always the same error:
SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:793
789▕ // If an exception occurs when attempting to run a query, we'll format the error
790▕ // message to include the bindings with SQL, which will make this exception a
791▕ // lot more helpful to the developer instead of just the database's errors.
792▕ catch (Exception $e) {
➜ 793▕ throw new QueryException(
794▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
795▕ );
796▕ }
797▕ }
Any hint for me?
Regards
D
ps:: The problem is the select query.
select * from information_schema.tables where table_schema = blog and table_name = migrations and table_type = 'BASE TABLE')
It should be _schema = "blog" and _name = "migrations". But got this in all laravel versions I have tried.