数据库转移mysql转postgres

  • 1004 字
  1. 1. mysql以及postgres在docker下的运行指导compose.yml
    1. 1.1. mysql: compose.yml
    2. 1.2. postgres: compose.yml
  2. 2. why postgres ?

mysql以及postgres在docker下的运行指导compose.yml

mysql: compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
# 简单配置,只配置了密码和数据库挂载目录,指定版本为8.0.35
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
# 简单配置,只配置了默认的密码和数据库挂载目录,指定版本为17-alpine的最新版本;默认用户为postgres
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,学习新数据库也不是啥坏事。

打赏
打赏提示信息
分享
分享提示信息