From 5c27e7cedccbde14d3075e2645ad3c4c528d40e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=AF=E6=98=8E?= <455043818@qq.com> Date: Wed, 4 Sep 2024 16:53:47 +0800 Subject: [PATCH] =?UTF-8?q?chore:9=E6=9C=884=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/daily/2024-09.md | 3 +++ docs/javascript/2023-11-15-docker-mysql.md | 25 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/docs/daily/2024-09.md b/docs/daily/2024-09.md index 088c7377d7..2441d39c0e 100644 --- a/docs/daily/2024-09.md +++ b/docs/daily/2024-09.md @@ -1,2 +1,5 @@ +## 9月4日 + cron vue3 + - https://abichinger.github.io/vue-js-cron/demo.html ## 9月3日 - 在线figma 模板 https://bentogrids.com/ \ No newline at end of file diff --git a/docs/javascript/2023-11-15-docker-mysql.md b/docs/javascript/2023-11-15-docker-mysql.md index 6c825840b3..e1256871c5 100644 --- a/docs/javascript/2023-11-15-docker-mysql.md +++ b/docs/javascript/2023-11-15-docker-mysql.md @@ -10,6 +10,31 @@ -e MYSQL_ROOT_PASSWORD=123456 -d mysql ``` +## 创建一个无密码的容器 +``` +docker stop mysql-原来的容器 + +//创建一个新的MySQL容器,覆盖默认的命令 +docker run --name mysql-temp -v /root/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0 --skip-grant-tables + +//稍等片刻 进入容器,并直接进入mysql + +docker exec -it mysql-temp mysql + +# 5. 在MySQL提示符下,执行以下SQL命令来重置root密码 +FLUSH PRIVILEGES; +ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; +FLUSH PRIVILEGES; +EXIT; + +// 停止并删除临时容器 +docker stop mysql-temp +docker rm mysql-temp + +// 重新启动原始的MySQL容器(使用新密码) +docker start mysql-container +``` + ## 查看容器的ip地址 - docker inspect 容器id/容器name ```