mysql以及postgres在docker下的运行指导compose.yml
mysql: compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13
| services: mysql: container_name: mysql volumes: - '~/mysql/data:/var/lib/mysql' network_mode: bridge restart: unless-stopped ports: - '3306:3306' environment: - MYSQL_ROOT_PASSWORD=passwd image: 'mysql:8.0.35'
|
postgres: compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| name: postgreSQL services: postgres: container_name: postgres17 ports: - 5432:5432 network_mode: bridge volumes: - ~/postgres/data:/var/lib/postgresql/data restart: always environment: POSTGRES_PASSWORD: 9264 image: postgres:17-alpine
|
why postgres ?
测试服务器下,静态数据库内存和cpu占用:
- |
mem |
cpu |
mysql |
390 MB |
0.20% |
postgres |
22 MB |
0.02% |
其次:有些数据库是蠢,有些是坏,它是又蠢又坏
再者:目前只会只用mysql和slite3,学习新数据库也不是啥坏事。