英文:
Docker mysql data not reflecting chages
问题
我在尝试使用Docker运行MySQL时遇到了一些问题。我使用了这个示例:
https://github.com/gpuenteallott/golang-mysql-docker-setup/blob/master/docker-compose.yml
它运行得很好。所以我可以登录到Sequel Pro,主机为127.0.0.1:3306,用户名和密码为gotest,一切都正常。然后我想要更改数据库名称和登录详细信息,所以我将docker-compose.yaml文件更改为以下内容:
app_database:
build:
context: .
dockerfile: docker/db/Dockerfile
ports:
- "3306:3306"
environment:
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: big-website-2014
volumes:
- ../../../../_local_mysql_data:/var/lib/mysql
然后我运行了所有的东西,但是我无法登录。我仍然可以使用旧的详细信息登录,并且旧的数据库仍然存在,但是没有任何新数据。
我尝试停止和删除所有容器和镜像,重新构建,但仍然没有成功。
我还尝试使用Docker的IP地址。
请有人对这个问题给予解答,谢谢。
英文:
I am having some issues trying to run mysql with docker. I used this example
https://github.com/gpuenteallott/golang-mysql-docker-setup/blob/master/docker-compose.yml
Which worked like a charm. SO I could then log into sequel pro host 127.0.0.1:3306. username, password = gotest. Worked perfect. I then wanted to change the db name and login in details to I changed my docker-compose.yaml file to look like this
app_database:
build:
context: .
dockerfile: docker/db/Dockerfile
ports:
- "3306:3306"
environment:
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: big-website-2014
volumes:
- ../../../../_local_mysql_data:/var/lib/mysql
I then run every thing but I cannot seem to log in. I can still log into with the old details and old database is still there. But not any of the new data.
I have tried stoping and removing all containers and images. Rebuild , every thing still no joy.
I have also tried using the docker ip address aswell.
Can some one please educate me on this matter please and thank you.
答案1
得分: 0
您的MySQL数据位于主机目录../../../../_local_mysql_data
。删除该目录,然后使用docker-compose up -d
重新创建您的容器。
英文:
Your MySQL Data is in host directory ../../../../_local_mysql_data
. Remove that directory and then recreate your container with docker-compose up -d
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论