docs: 添加 MySQL 容器部署日志(服务器/账号/重建命令)
This commit is contained in:
commit
2318fb1ea8
16
AGENTS.md
Normal file
16
AGENTS.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# AGENTS.md
|
||||||
|
|
||||||
|
## Project overview
|
||||||
|
|
||||||
|
This repository is currently **empty**. As of the time this file was written:
|
||||||
|
|
||||||
|
- The working directory contains no source files, configuration files, or documentation.
|
||||||
|
- The git repository (`main` branch) has **no commits**, no remote configured, and no other branches or stashes.
|
||||||
|
|
||||||
|
There is no technology stack, build process, module layout, testing strategy, or deployment process to document yet.
|
||||||
|
|
||||||
|
## Guidance for agents
|
||||||
|
|
||||||
|
- Do not assume any language, framework, or tooling — none has been established.
|
||||||
|
- When the first project files are added, rewrite this file to document the actual
|
||||||
|
project overview, build/test commands, code style, and testing instructions.
|
||||||
66
docks/mysql-deploy-log.md
Normal file
66
docks/mysql-deploy-log.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# MySQL 容器部署日志
|
||||||
|
|
||||||
|
部署时间:2026-09-01
|
||||||
|
|
||||||
|
## 服务器
|
||||||
|
|
||||||
|
- IP:`47.112.207.185`(阿里云,Gitea 也在这台机器上,端口 3000)
|
||||||
|
- SSH:`ssh evanliu@47.112.207.185`
|
||||||
|
- SSH 密码:`@PRll1978`
|
||||||
|
|
||||||
|
Windows Git Bash 下免交互登录(无 sshpass 时):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p /tmp/sshask && printf '#!/bin/sh\necho "@PRll1978"\n' > /tmp/sshask/pass.sh && chmod +x /tmp/sshask/pass.sh
|
||||||
|
export SSH_ASKPASS=/tmp/sshask/pass.sh SSH_ASKPASS_REQUIRE=force DISPLAY=:0
|
||||||
|
ssh -n evanliu@47.112.207.185 '<远程命令>'
|
||||||
|
```
|
||||||
|
|
||||||
|
## MySQL 容器
|
||||||
|
|
||||||
|
- 容器名:`mysql`,镜像 `mysql:8.4`(MySQL 8.4.11)
|
||||||
|
- 端口:`0.0.0.0:3306 -> 3306`
|
||||||
|
- 数据卷:`mysql_data` -> `/var/lib/mysql`
|
||||||
|
- 重启策略:`unless-stopped`
|
||||||
|
|
||||||
|
启动命令(重建时用):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name mysql --restart unless-stopped \
|
||||||
|
-p 3306:3306 -v mysql_data:/var/lib/mysql \
|
||||||
|
-e "MYSQL_ROOT_PASSWORD=@PRll1978" -e TZ=Asia/Shanghai \
|
||||||
|
mysql:8.4
|
||||||
|
```
|
||||||
|
|
||||||
|
注意:服务器直连 Docker Hub 超时,镜像通过加速器 `docker.1ms.run` 拉取后重打标签:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull docker.1ms.run/library/mysql:8.4
|
||||||
|
docker tag docker.1ms.run/library/mysql:8.4 mysql:8.4
|
||||||
|
```
|
||||||
|
|
||||||
|
## 账号
|
||||||
|
|
||||||
|
| 账号 | 密码 | host | 权限 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| root | `@PRll1978` | `%`(支持远程) | 全部 |
|
||||||
|
| evanliu | `@PRll1978` | `%`(支持远程) | `ALL PRIVILEGES ON *.*` + `WITH GRANT OPTION`,等同 root |
|
||||||
|
|
||||||
|
创建 evanliu 的 SQL:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE USER IF NOT EXISTS "evanliu"@"%" IDENTIFIED BY "@PRll1978";
|
||||||
|
GRANT ALL PRIVILEGES ON *.* TO "evanliu"@"%" WITH GRANT OPTION;
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
```
|
||||||
|
|
||||||
|
远程连接:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mysql -h 47.112.207.185 -P 3306 -u evanliu -p
|
||||||
|
# 密码: @PRll1978
|
||||||
|
```
|
||||||
|
|
||||||
|
## 风险提示
|
||||||
|
|
||||||
|
- root 和 evanliu 均允许任意主机连接,公网暴露 3306 风险较高,建议阿里云安全组只放行需要的来源 IP。
|
||||||
Loading…
x
Reference in New Issue
Block a user