我可以在同一系统上使用mysql,oracle数据库以及sql server

时间:2015-05-05 06:09:03

标签: mysql sql-server

我在我的系统上安装了python manage.py migrate --fake ,但现在我也需要安装SQL-Server 2008 r2。是否可以并排安装MYSQL和SQL-Server。在同一系统上安装SQL-Server和MYSQL是否会相互影响?

2 个答案:

答案 0 :(得分:2)

是的,这是可能的。但是你必须确保他们监听的端口是不同的。默认mysql使用端口3306而SQL服务器使用端口1433.它们都是应用程序,就像任何其他应用程序一样。使用不同的进程,因此它们应该在同一台机器上运行而没有任何冲突。在设置时,请确保您正确配置端口,以便它们不使用相同的端口,系统也应该检测到该端口正由另一个应用程序使用。

答案 1 :(得分:1)

您问题的简单答案是Docker,我创建了一个教程,其中在具有3GB RAM的单个CentOS系统中同时安装和运行MySQL,MSSQL,Oracle,PostgreSQL和MongoDB,并且不会互相影响:

https://adhoctuts.com/run-mulitple-databases-in-single-machine-using-docker-vagrant/ https://www.youtube.com/watch?v=LeqkCoX28qg

以下是本教程中docker-compose.yml文件的内容,但您还需要其他文件(所有文件都位于以下git存储库中:https://github.com/mamedshahmaliyev/adhoctuts/tree/master/docker/multiple_databases)。如果您只需要MySQL和MSSQL,只需从docker-compose.yml中删除其他服务并运行docker-compose up:

# link to tutorial: https://adhoctuts.com/run-mulitple-databases-in-single-machine-using-docker-vagrant/

version: "3.1"

networks:
  docker-network:  

services:
# https://hub.docker.com/_/mysql
  mysql_persistance: # service name
    image: mysql:8
    container_name: mysql_p # container_name
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - /docker/mysql/data:/var/lib/mysql # for data persistance
      - /docker/mysql/conf:/etc/mysql/conf.d # put all the custom configuration files from host to container
    environment:
      - MYSQL_ROOT_PASSWORD=AdHocTuts2019@
    ports:
      - "3309:3306" # map host port to container port
    networks:
      - docker-network
    #restart: on-failure

  mysql_no_persistance:
    image: mysql:5.7
    container_name: mysql_np
    environment:
      - MYSQL_ROOT_PASSWORD=AdHocTuts2019@
    ports:
      - "3308:3306"
    networks:
      - docker-network

# https://hub.docker.com/_/microsoft-mssql-server
  mssql:
    image: mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
    container_name: mssql
    volumes:
      - /docker/mssql/data:/var/opt/mssql
    environment:
      - SA_PASSWORD=AdHocTuts2019@
      - ACCEPT_EULA=Y
      - TZ=Asia/Baku
      - MSSQL_PID=Express
    ports:
      - "1433:1433"
    networks:
      - docker-network

# https://hub.docker.com/_/oracle-database-enterprise-edition
# Accept Terms of Service for Oracle Database Enterprise Edition (Proceed to Checkout). 
# Then in command line: docker login
# sqlplus sys/Oradoc_db1@ORCLDB as sysdba
  oracle:
    image: store/oracle/database-enterprise:12.2.0.1-slim
    container_name: oracle
    volumes:
      - /docker/oracle/data:/ORCL # host path must have 777 permission or writable by docker oracle user
    environment:
      - DB_SID=ORCLDB
      - DB_MEMORY=1GB
    ports:
      - "1521:1521"
    networks:
      - docker-network

# https://hub.docker.com/_/postgres
  postgres:
    image: postgres:12
    container_name: postgres
    volumes:
      - /docker/postgre/data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=AdHocTuts2019@
      - POSTGRES_USER=postgres
      - POSTGRES_DB=docker_db
    ports:
      - "5432:5432"
    networks:
      - docker-network

# https://hub.docker.com/_/mongo
  mongo:
    image: mongo:3.4.21-xenial
    container_name: mongo
    volumes:
      - /docker/mongo/data:/data/db
    environment:
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD=AdHocTuts2019@
    ports:
      - "27017:27017"
    networks:
      - docker-network