猿创征文|Linux centos7下利用docker快速部署SQLserver测试学习环境

简介: 猿创征文|Linux centos7下利用docker快速部署SQLserver测试学习环境

前言

在学习的时候,其实有一个正确的方法比起有一个正确的态度是更好的。就好比数据库的学习或者测试,如果我们要部署一个完整的可用的数据库,可能会需要耗费很多的时间和精力,而这些成本我们一般称之为沉没成本,因此,为了避免这些不必要的麻烦,选择一个快速的,准确的方法是非常有必要的哦。

那么,docker这样一种虚拟化技术就是非常的适合数据库的学习和测试啦。

接下来我将介绍从docker环境搭建开始直到一个完全可用的SQLserver服务器部署搭建完成的全过程。

先决条件

(1)centos7服务器

(1)docker环境

(2)Navicat  premium

一,

docker环境的搭建

docker的离线安装以及本地化配置_zsk_john的博客-CSDN博客

这里注意一点,一定要配置本地化。

二,

镜像下载地址:

Docker Hub  运行方法,示例什么的都有哦

官网好就好在连命令都给你提供了,docker pull命令为:

docker pull mcr.microsoft.com/mssql/server:2017-latest

启动SQLserver这个镜像:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=WhatIsUp_321" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest

密码是WhatIsUp_321,SQLserver会检测密码的哦,因此,需要设置带字母数字特殊符号的密码

查看该容器得日志:

[root@slave1 openssh-8.6p1]# docker logs 83b2e
SQL Server 2017 will run as non-root by default.
This container is running as user root.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
2022-09-01 08:06:59.32 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2022-09-01 08:06:59.48 Server      Did not find an existing master data file /var/opt/mssql/data/master.mdf, copying the missing default master and other system database files. If you have moved the database location, but not moved the database files, startup may fail. To repair: shutdown SQL Server, move the master database to configured location, and restart.
2022-09-01 08:06:59.49 Server      Setup step is copying system data file 'C:\templatedata\mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'.
2022-09-01 08:06:59.51 Server      Setup step is copying system data file 'C:\templatedata\model.mdf' to '/var/opt/mssql/data/model.mdf'.
2022-09-01 08:06:59.65 Server      Setup step is copying system data file 'C:\templatedata\modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
2022-09-01 08:06:59.79 Server      Setup step is copying system data file 'C:\templatedata\msdbdata.mdf' to '/var/opt/mssql/data/msdbdata.mdf'.
2022-09-01 08:07:00.05 Server      Setup step is copying system data file 'C:\templatedata\msdblog.ldf' to '/var/opt/mssql/data/msdblog.ldf'.
2022-09-01 08:07:00.13 Server      Microsoft SQL Server 2017 (RTM-CU30) (KB5013756) - 14.0.3451.2 (X64) 
  Jun 22 2022 18:20:15 
  Copyright (C) 2017 Microsoft Corporation
  Developer Edition (64-bit) on Linux (Ubuntu 18.04.6 LTS)
2022-09-01 08:07:00.14 Server      UTC adjustment: 0:00
2022-09-01 08:07:00.15 Server      (c) Microsoft Corporation.
。。。。。。。。。。。。。略略略
2022-09-01 08:07:05.36 spid11s     The tempdb database has 1 data file(s).
2022-09-01 08:07:05.37 spid24s     The Service Broker endpoint is in disabled or stopped state.
2022-09-01 08:07:05.37 spid24s     The Database Mirroring endpoint is in disabled or stopped state.
2022-09-01 08:07:05.42 spid24s     Service Broker manager has started.
2022-09-01 08:07:05.51 spid5s      Recovery is complete. This is an informational message only. No user action is required.
2022-09-01 08:07:05.70 spid20s     The default language (LCID 0) has been set for engine and full-text services.

OK了,这个镜像没有挂载volume。但,没关系,这不影响使用。如果想要挂载volume,容器内的挂载点路径是:/var/opt/mssql/data  剩下的就不用我说了吧,懂的都懂!!~~~~~~~~~~~

三,

打开Navicat premium开始连接SQLserver这个容器(linux服务器的IP地址是192.168.217.17,端口不需要指定,初始数据库也使用默认的master,用户名必须是sa,密码是WhatIsUp_321):

但,很可能会报错:

找到Navicat的安装目录,找到sqlncli_x64.msi,手动安装一哈这个SQLserver的客户端就可以啦。

再次连接应该就不会报错了。

总结

docker十分的方便哦,数据库基本都不需要设置什么,像什么远程连接权限啊 什么的统统不用考虑,真正的开箱即用哦。

 

目录
相关文章
|
7月前
|
SQL 安全 Linux
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
404 1
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
|
7月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
828 1
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
|
7月前
|
应用服务中间件 Linux nginx
在虚拟机Docker环境下部署Nginx的步骤。
以上就是在Docker环境下部署Nginx的步骤。需要注意,Docker和Nginix都有很多高级用法和细节需要掌握,以上只是一个基础入门级别的教程。如果你想要更深入地学习和使用它们,请参考官方文档或者其他专业书籍。
371 5
|
8月前
|
安全 Linux 网络安全
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
486 2
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
|
8月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
549 1
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
|
9月前
|
运维 Linux 开发者
Linux系统中使用Python的ping3库进行网络连通性测试
以上步骤展示了如何利用 Python 的 `ping3` 库来检测网络连通性,并且提供了基本错误处理方法以确保程序能够优雅地处理各种意外情形。通过简洁明快、易读易懂、实操性强等特点使得该方法非常适合开发者或系统管理员快速集成至自动化工具链之内进行日常运维任务之需求满足。
640 18
|
9月前
|
缓存 Ubuntu Docker
Ubuntu环境下删除Docker镜像与容器、配置静态IP地址教程。
如果遇见问题或者想回滚改动, 可以重启系统.
581 16
|
8月前
|
安全 Linux 网络安全
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
667 0
|
安全 Linux 测试技术
OpenText Static Application Security Testing (Fortify) 25.3 (macOS, Linux, Windows) - 静态应用安全测试
OpenText Static Application Security Testing (Fortify) 25.3 (macOS, Linux, Windows) - 静态应用安全测试
761 0