Home>

I am building a virtual environment by building an environment with docker + rails + mysql.
Link content
It's a bit long because I made it referring to the above-mentioned yutube, but if you have time, I think it will be easier to understand if you can see it.

I think there are many points that are lacking in explanation or difficult to understand, but if i am familiar with this, I would appreciate your advice.

When I did docker-compose up, Unknown database'myapp_development' appeared on the browser side, so I made docker-compose run web rails db: create as explained in the video attached to the link, but db was created due to the following error I could not do it.

$docker-compose run web rails db:create
Mysql2::Error: Can't create database'myapp_development' (errno: 1438434304): CREATE DATABASE `myapp_development` DEFAULT CHARACTER SET `utf8`
Couldn't create'myapp_development' database. Please check your configuration.
rails aborted!
ActiveRecord::StatementInvalid: Mysql2::Error: Can't create database'myapp_development' (errno: 1438434304): CREATE DATABASE `myapp_development` DEFAULT CHARACTER SET `utf8`
~~~
~~~
What I tried

I googled a lot and tried the following.
1. Start mysql
→ It is started and started normally, but the same error appears even if docker-compose run web rails db: create again.

2. Reinstall mysql
→I was able to install it by brew install [email protected] but this also gives the same error

3,Link content
I thought that I should refer to the second link above, but I have not decided because it is really good for this process because it is a beginner

It is the situation.
I'm sorry for the difficult text, but if i am familiar with this, I would appreciate your help.

Supplemental information (FW/tool ​​version, etc.)

macbook air
mac Os catalina
ruby 2.5.8
bundle 2.1.4