We are currently studying with the book "PHP Framework Laravel Wev Application Development".
For books, we are building sites using Vagrant and Homestead, but due to various circumstances, we would like to build sites with Docker this time.
There is a process of migration using the command "$php artisan migrate" in p34,35 of this document, but this does not work.
The following results are returned when executed in the terminal.
In Connection.php line 664: SQLSTATE [HY000]  Access denied for user 'homestead'@'172.22.0.1' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations) In Connector.php line 67: SQLSTATE [HY000]  Access denied for user 'homestead'@'172.22.0.1' (using password: YES)
Actually, the order of this work is
- Environment construction with Vagrant and Homestead
- Environment construction with Docker and Laradock
- Learn later on Docker
We are proceeding with this, and I think that perhaps the reason for this error was that we first built the environment with Homestead.
However, it is difficult to understand how to solve the problem.
Maybe the migration procedure on Docker is different from Homestead = I thought it would be impossible to proceed according to the book procedure. Is it necessary to make SQL connection settings in advance?
The last thing we want to do is create a database and tables to implement the authentication/registration function provided as standard in Laravel.
Excuse me, but if you know someone, I hope you can open the teaching board.
Answer # 1
We are happy to report that we were able to resolve the problem.
First of all, my premise was missing from my perception, and I didn't share it with you. Excuse me.
The premise is that you are using laradock.
Because it was out of my recognition, I was investigating only how to build a laravel environment on Docker without using laradock, so I could not solve it forever.
Here are the steps that have been taken.
First of all, in the order of "Connection setting to MySQL", "Connection to Workspace container", "Use artisan command" in the following site
* As the original thread, I built the environment with reference to the book "PHP framework Laravel Wev application development", so I replaced the src of the above site with sampleapp and executed it.
Then, the following error appears (error content has changed).
In Connection.php line 664: SQLSTATE [HY000]  The server requested authentication method unknown to the client (SQL: select * from information_sche ma.tables where table_schema = default and table_name = migrations) In Connector.php line 67: SQLSTATE [HY000]  The server requested authentication method unknown to the client In Connector.php line 67: PDO :: __ construct (): The server requested authentication method unknown to the client [caching_sha2_password]
To solve the above error, execute "[Solution 2] Change MySQL Authentication Method" in the link below
* On the way
ALTER USER 'homestead' @ '%' IDENTIFIED WITH mysql_native_password BY 'secret';
There is an execution of the SQL statement, but this time I changed 'homestead' to 'default' and executed it to match the setting made in step 1.
After completing the above, enter workspase again and type the command 'php artisan migrate' ...
Migration table created successfully. Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table Migrating: 2014_10_12_100000_create_password_resets_table Migrated: 2014_10_12_100000_create_password_resets_table
Answer # 2
Is it necessary to make SQL connection settings in advance in the .env file or something in this case?
Set DB connection settings for Docker in .env (setting information depends on environment)
php artisan config: clear
After destroying the config cache in
Please run php artisan migrate again
- php - laravel migration error handling
- docker laravel pusher 500 error
- i deployed the laravel + mysql + vue app on heroku, but i get a 500 error in the api part
- php - error when installing bensampo/laravel-enum on laravel 5838
- cannot create database with docker
- how to create a custom error message in laravel
- error when registering as a main member with laravel
- php - [laravel] undefined variable: error is displayed
- nginx - laravel error using docker-composeyml
- php - laravel: i want to get the prefecture from the id registered in the database using the configuration file
- laravel: how to pass image path from database to css file
- laravel - i get a 500 error when deploying heroku
- after deploying to herokum with laravel i get the error class'app\product' not found
- laravel - stack error: command failed: appears when npm install
- php - laravel error cannot be resolved
- laravel - laradock exit(3) error
- error message from mysql when opening laravel app
- i want to display dynamic form error messages in laravel
- creating laravel's own error page
- unable to register user in db with docker + laravel + vuejs
- sqlite - vuls was built with podman (docker compatible) with centos8, but the vulnerability information database cannot be updat
- ruby - docker container, volume rebuild
- ruby - [docker] could not translate host name "db" to address: name or service not known
- mysql2 error when deploying docker to an existing rails app
- php - docker laravel i would like to know the location of the log that was the standard output during batch execution
- database - i want to do db: create using docker
- aws - about the case of using docker in a production environment
- ruby - [docker] connection to mysql is refused
- php - fatal: database "port=5432" does not exist when starting docker