2/25/2023 0 Comments Tableplus connect to localhost![]() ![]() Adding environment variables to connect to the mysql service When we run the container for the first time, MySQL will automatically create a database named myapp since we provided the MYSQL_DATABASE=myapp environment variable. This is how the data is persisted to our local machine. data/mysql directory in our project data directory that we created on localhost. ![]() Note that the MySQL server port 3306 internal to the docker network is mapped to port 8001 on our localhost so that we can connect to the instance on localhost:8000.Īlso Note that we have docker volumes mapping that maps the docker directory /var/lib/mysql where MySQL stores its data to the. data/mysql:/var/lib/mysql environment : - MYSQL_ROOT_PASSWORD=myapp - MYSQL_DATABASE=myapp - MYSQL_USER=myapp - MYSQL_PASSWORD=myapp ports : - " 8001:3306" Mysql : image : mysql:8.0 container_name : myapp-mysql volumes :. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |