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
- error when upgrading laravel 6x → 7x cannot be resolved
- error is output periodically by laravel
- i want to take data from the database with laravel and display it
- ruby on rails - [docker] i get an error when i run rails db: migrate
- ruby on rails - [docker] mysql2 :: error :: connectionerror: unknown mysql server host'db' (-2)
- mysql - about docker error
- php - error that occurs when laravel follow function undefined variable: user
- can you tell me what to do with the laravel sqlstate [42s21] error?
- "sqlite3operationalerror: unable to open database file" error in python
- laravel migration i want to know how to reorder existing columns
- laravel deployed to mixhost is not the top page 404 error i want to check httpdconf
- laravel58 error with laravel-mix
- laravel - error "your requirements could not be resolved to an installable set of packages"
- php - laravel: i want to resolve the error target class [***] does not exist
- macos (osx) - docker error
- laravel - when i run the npm install command, i get the error no such file or directory
- i want to display dynamic form error messages in laravel
- [laravel] i get error 404
- cannot create database with docker
- how to create a custom error message in laravel
- mysql - questions about docker errors
- php - laravel error cannot be resolved
- aws - about the case of using docker in a production environment
- ruby - [docker] connection to mysql is refused
- sqlite - vuls was built with podman (docker compatible) with centos8, but the vulnerability information database cannot be updat
- php - fatal: database "port=5432" does not exist when starting docker
- php - laradock shows 404 not found
- php - laravel app does not work on docker
- database - an unspecified directory is set as the mount destination
- i want to create an initial database when starting a mysql container with docker