zoukankan      html  css  js  c++  java
  • docker 安装 sqlserver 数据库

    具备条件:

    1.服务器需要大于2G内存。如果不够则可能无法正常启动,查看日志报如下错误:
    This program requires a machine with at least 2000 megabytes of memory

    2、获取 sqlserver 镜像
    $ docker pull mcr.microsoft.com/mssql/server:2017-latest

    镜像下载成功后,运行镜像
    $ docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=sa1122.?' -p 33061:1433 -v /opt/data/sqlserver/:/var/opt/mssql/data/ --name sqlserver -d mcr.microsoft.com/mssql/server:2017-latest

    查看日志

    2019-03-27 09:25:02.28 spid7s      Converting database 'msdb' from version 862 to the current version 869.
    2019-03-27 09:25:02.29 spid7s      Database 'msdb' running the upgrade step from version 862 to version 863.
    2019-03-27 09:25:02.30 spid10s     Converting database 'model' from version 862 to the current version 869.
    2019-03-27 09:25:02.30 spid10s     Database 'model' running the upgrade step from version 862 to version 863.
    2019-03-27 09:25:02.43 spid10s     Database 'model' running the upgrade step from version 863 to version 864.
    2019-03-27 09:25:02.43 spid7s      Database 'msdb' running the upgrade step from version 863 to version 864.
    2019-03-27 09:25:02.45 spid10s     Database 'model' running the upgrade step from version 864 to version 865.
    2019-03-27 09:25:02.46 spid7s      Database 'msdb' running the upgrade step from version 864 to version 865.
    2019-03-27 09:25:02.46 spid10s     Database 'model' running the upgrade step from version 865 to version 866.
    2019-03-27 09:25:02.47 spid7s      Database 'msdb' running the upgrade step from version 865 to version 866.
    2019-03-27 09:25:02.48 spid10s     Database 'model' running the upgrade step from version 866 to version 867.
    2019-03-27 09:25:02.49 spid7s      Database 'msdb' running the upgrade step from version 866 to version 867.
    2019-03-27 09:25:02.50 spid10s     Database 'model' running the upgrade step from version 867 to version 868.
    2019-03-27 09:25:02.51 spid7s      Database 'msdb' running the upgrade step from version 867 to version 868.
    2019-03-27 09:25:02.52 spid10s     Database 'model' running the upgrade step from version 868 to version 869.
    2019-03-27 09:25:02.52 spid7s      Database 'msdb' running the upgrade step from version 868 to version 869.
    2019-03-27 09:25:02.65 spid10s     Polybase feature disabled.
    2019-03-27 09:25:02.65 spid10s     Clearing tempdb database.
    2019-03-27 09:25:03.07 spid10s     Starting up database 'tempdb'.
    2019-03-27 09:25:03.33 spid10s     The tempdb database has 1 data file(s).
    2019-03-27 09:25:03.33 spid22s     The Service Broker endpoint is in disabled or stopped state.
    2019-03-27 09:25:03.33 spid22s     The Database Mirroring endpoint is in disabled or stopped state.
    2019-03-27 09:25:03.35 spid22s     Service Broker manager has started.
    2019-03-27 09:25:03.44 spid7s      Recovery is complete. This is an informational message only. No user action is required.
    2019-03-27 09:25:03.47 spid24s     The default language (LCID 0) has been set for engine and full-text services.

    3、登录 sqlserver 容器
    docker exec -it sqlserver bash

    4、链接 sqlserver
    /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P password
    eg、/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P sa1122.?

    5、执行命令
    SELECT Name from sys.Databases
    GO

    ### 创建数据库
    create database mytest COLLATE Chinese_PRC_CI_AS

  • 相关阅读:
    realsense SDK debug
    网络
    JVM基础系列第11讲:JVM参数之堆栈空间配置
    图片一句话木马简单制作方法
    RocketMQ(四):生产者消息数据写入实现细节
    RocketMQ(三):broker启动逻辑
    发现一个新的技术网站 https://dotnet9.com/
    【最新】解决Github网页上图片显示失败的问题
    c++入门
    Newtonsoft.Json json.net 可以丢弃了,微软发布了 System.Text.Json 适用于.net 4.6.1 +,后悔了,建议.net5+项目使用
  • 原文地址:https://www.cnblogs.com/linjiqin/p/11283184.html
Copyright © 2011-2022 走看看