mirror of https://github.com/docker/docs.git
edits made to section 'Run your app with MySQL'
The created docker network `todo-app` was unable to support an authentication protocol requested by MySQL versions 8.0 and higher. I included a fix suggested by **stackoverlfow** user [Pras](https://stackoverflow.com/a/50131831/11492382).
This commit is contained in:
parent
436bdc3d98
commit
d0db5f0c8b
|
@ -178,7 +178,12 @@ The todo app supports the setting of a few environment variables to specify MySQ
|
||||||
|
|
||||||
With all of that explained, let's start our dev-ready container!
|
With all of that explained, let's start our dev-ready container!
|
||||||
|
|
||||||
1. We'll specify each of the environment variables above, as well as connect the container to our app network.
|
1. **Note**: for MySQL versions 8.0 and higher, make sure to include the following commands in `mysql`.
|
||||||
|
```console
|
||||||
|
mysql> ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY 'secret';
|
||||||
|
mysql> flush privileges;
|
||||||
|
```
|
||||||
|
2. We'll specify each of the environment variables above, as well as connect the container to our app network.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -dp 3000:3000 \
|
$ docker run -dp 3000:3000 \
|
||||||
|
@ -205,8 +210,7 @@ With all of that explained, let's start our dev-ready container!
|
||||||
node:12-alpine `
|
node:12-alpine `
|
||||||
sh -c "yarn install && yarn run dev"
|
sh -c "yarn install && yarn run dev"
|
||||||
```
|
```
|
||||||
|
3. If we look at the logs for the container (`docker logs <container-id>`), we should see a message indicating it's
|
||||||
2. If we look at the logs for the container (`docker logs <container-id>`), we should see a message indicating it's
|
|
||||||
using the mysql database.
|
using the mysql database.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
@ -219,9 +223,9 @@ With all of that explained, let's start our dev-ready container!
|
||||||
Listening on port 3000
|
Listening on port 3000
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Open the app in your browser and add a few items to your todo list.
|
4. Open the app in your browser and add a few items to your todo list.
|
||||||
|
|
||||||
4. Connect to the mysql database and prove that the items are being written to the database. Remember, the password
|
5. Connect to the mysql database and prove that the items are being written to the database. Remember, the password
|
||||||
is **secret**.
|
is **secret**.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
|
Loading…
Reference in New Issue