I created a mysql docker container mysqlcontainer using following command:
docker exec -it mysqlcontainer -d mysql/mysql-server
I run docker logs mysqlcontainer and get the following:
[Entrypoint] GENERATED ROOT PASSWORD: FB=?ySG5,3#@kur&,Wj459fk2Gy2C_O8
[Entrypoint] ignoring /docker-entrypoint-initdb.d/*
[Entrypoint] MySQL init process done. Ready for start up.
2022-04-22T07:49:23.295242Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld:
I want to put this generated root password into a variable so that I can use this variable in shell script.
I used the following command to get password but how can I put the password into a variable
docker logs mysqlcontainer 2>&1 | grep GENERATED
[Entrypoint] GENERATED ROOT PASSWORD: FB=?ySG5,3#@kur&,Wj459fk2Gy2C_O8