学习SQL Server从在Linux上安装开始
微软已经发布了SQL Server on Linux,目前支持Redhat和Ubuntu两种发行版。
下面我们来安装体验一下。
1. 获得YUM源:
YUM的repo文件地址:
https://packages.microsoft.com/config/rhel/7/mssql-server.repo
下载到本地:
wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo
---- ::-- https://packages.microsoft.com/config/rhel/7/mssql-server.repo
Resolving packages.microsoft.com (packages.microsoft.com)... 13.75.127.55
Connecting to packages.microsoft.com (packages.microsoft.com)|13.75.127.55|:... connected.
HTTP request sent, awaiting response... OK
Length: [application/octet-stream]
Saving to: 'mssql-server.repo'
%[=================================================================================================================================>] --.-K/s in 0s
-- :: (47.7 MB/s) - 'mssql-server.repo' saved [/]
把此文件复制到/etc/yum.repos.d目录:
cp mssql-server.repo /etc/yum.repos.d/
更新yum信息:
[root@hwweb0 ~]# yum makecache
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB ::
extras | 3.4 kB ::
openlogic | 1.3 kB ::
packages-microsoft-com-mssql-server | 2.9 kB ::
updates | 3.4 kB ::
(/): extras//x86_64/prestodelta | kB ::
(/): openlogic//x86_64/filelists | 6.7 kB ::
(/): openlogic//x86_64/other | 3.7 kB ::
(/): extras//x86_64/filelists_db | kB ::
(/): extras//x86_64/other_db | kB ::
(/): packages-microsoft-com-mssql-server/filelists_db | 1.4 kB ::
(/): packages-microsoft-com-mssql-server/other_db | B ::
(/): base//x86_64/other_db | 2.3 MB ::
(/): updates//x86_64/prestodelta | kB ::
(/): updates//x86_64/filelists_db | 5.3 MB ::
(/): base//x86_64/filelists_db | 6.2 MB ::
(/): updates//x86_64/other_db | MB ::
(/): packages-microsoft-com-mssql-server/primary_db | 2.4 kB ::
Loading mirror speeds from cached hostfile
openlogic /
openlogic /
Metadata Cache Created
2. 通过yum安装sql server:
Yum查找mssql的相关信息:
[root@hwweb0 ~]# yum search mssql
Loaded plugins: fastestmirror, langpacks
Repository packages-microsoft-com-mssql-server is listed more than once in the configuration
Loading mirror speeds from cached hostfile
=========================================================================== N/S matched: mssql ============================================================================
mssql-server.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine
mssql-server-ha.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine
Name and summary matches only, use "search all" for everything.
可以看到有两个版本,ha版本应该是做高可用性的版本。安装mssql-server:
[root@hwweb0 ~]# yum search mssql
Loaded plugins: fastestmirror, langpacks
Repository packages-microsoft-com-mssql-server is listed more than once in the configuration
Loading mirror speeds from cached hostfile
=========================================================================== N/S matched: mssql ============================================================================
mssql-server.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine
mssql-server-ha.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine
Name and summary matches only, use "search all" for everything.
[root@hwweb0 ~]# yum install mssql-server -y
Loaded plugins: fastestmirror, langpacks
Repository packages-microsoft-com-mssql-server is listed more than once in the configuration
packages-microsoft-com-mssql-server | 2.9 kB ::
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 :14.0.1.246- will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================
Installing:
mssql-server x86_64 14.0.1.246- packages-microsoft-com-mssql-server M
Transaction Summary
===========================================================================================================================================================================
Install Package
Total download size: M
Installed size: M
Downloading packages:
warning: /var/cache/yum/x86_64//packages-microsoft-com-mssql-server/packages/mssql-server-14.0.1.246-.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Public key for mssql-server-14.0.1.246-.x86_64.rpm is not installed
mssql-server-14.0.1.246-.x86_64.rpm | MB ::
Retrieving key from https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
Userid : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
Fingerprint: bc52 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mssql-server-14.0.1.246-.x86_64 /
+-------------------------------------------------------------------+
| Please run /opt/mssql/bin/sqlservr-setup to complete the setup of |
| Microsoft(R) SQL Server(R). |
+-------------------------------------------------------------------+
Verifying : mssql-server-14.0.1.246-.x86_64 /
Installed:
mssql-server.x86_64 :14.0.1.246-
Complete!
这样就安装好了。
3. 配置sql server
[root@hwweb0 bin]# pwd
/opt/mssql/bin
[root@hwweb0 bin]# ./sqlservr-setup
Microsoft(R) SQL Server(R) Setup
You can abort setup at anytime by pressing Ctrl-C. Start this program
with the --help option for information about running it in unattended
mode.
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388 and found
in /usr/share/doc/mssql-server/LICENSE.TXT.
Do you accept the license terms? If so, please type "YES": YES
Please enter a password for the system administrator (SA) account:
Please confirm the password for the system administrator (SA) account:
Setting system administrator (SA) account password...
sqlservr: This program requires a machine with at least megabytes of memory.
Microsoft(R) SQL Server(R) setup failed with error code .
Please check the setup log in /var/opt/mssql/log/setup--.log
for more information.
我采用的是A1的机器,配置过程提示,内存需要大于3G。把机器升级到A2:
[root@hwchefserver bin]# ./sqlservr-setup
Microsoft(R) SQL Server(R) Setup
You can abort setup at anytime by pressing Ctrl-C. Start this program
with the --help option for information about running it in unattended
mode.
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388 and found
in /usr/share/doc/mssql-server/LICENSE.TXT.
Do you accept the license terms? If so, please type "YES": YES
Please enter a password for the system administrator (SA) account:
Please confirm the password for the system administrator (SA) account:
Setting system administrator (SA) account password...
Do you wish to start the SQL Server service now? [y/n]: y
Do you wish to enable SQL Server to start on boot? [y/n]: y
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server-telemetry.service to /usr/lib/systemd/system/mssql-server-telemetry.service.
Setup completed successfully.
配置成功。检查状态:
[root@hwchefserver bin]# systemctl status mssql
● mssql.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
[root@hwchefserver bin]# systemctl status mssql-server
● mssql-server.service - Microsoft(R) SQL Server(R) Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
Active: active (running) since Thu -- :: UTC; 37s ago
Main PID: (sqlservr)
CGroup: /system.slice/mssql-server.service
├─ /opt/mssql/bin/sqlservr
└─ /opt/mssql/bin/sqlservr
Nov :: hwchefserver sqlservr[]: -- ::15.06 spid17s SQL Server is now ready for client connections. This is an infor...equired.
Nov :: hwchefserver sqlservr[]: -- ::15.13 spid6s Polybase feature disabled.
Nov :: hwchefserver sqlservr[]: -- ::15.13 spid6s Clearing tempdb database.
Nov :: hwchefserver sqlservr[]: -- ::16.91 spid6s Starting up database 'tempdb'.
Nov :: hwchefserver sqlservr[]: -- ::17.58 spid6s The tempdb database has data file(s).
Nov :: hwchefserver sqlservr[]: -- ::17.58 spid20s The Service Broker endpoint is in disabled or stopped state.
Nov :: hwchefserver sqlservr[]: -- ::17.58 spid20s The Database Mirroring endpoint is in disabled or stopped state.
Nov :: hwchefserver sqlservr[]: -- ::17.67 spid20s Service Broker manager has started.
Nov :: hwchefserver sqlservr[]: -- ::17.71 spid5s Recovery is complete. This is an informational message only. No ...equired.
Nov :: hwchefserver sqlservr[]: -- ::22.59 spid35s The activated proc '[dbo].[sp_syspolicy_events_reader]' running on queue...
Hint: Some lines were ellipsized, use -l to show in full.
SQL Server已经在运行。
3. 检查
安装SQL Tools。SQL Tools:sqlcmd是mssql ODBC的一个工具,可以通过yum的repo直接yum安装。
首先下载yum的repo:
[root@hwchefserver ~]# wget https://packages.microsoft.com/config/rhel/7/prod.repo
---- ::-- https://packages.microsoft.com/config/rhel/7/prod.repo
Resolving packages.microsoft.com (packages.microsoft.com)... 13.75.127.55
Connecting to packages.microsoft.com (packages.microsoft.com)|13.75.127.55|:... connected.
HTTP request sent, awaiting response... OK
Length: [application/octet-stream]
Saving to: 'prod.repo'
%[=================================================================================================================>] --.-K/s in 0s
-- :: (30.2 MB/s) - 'prod.repo' saved [/]
[root@hwchefserver ~]# mv prod.repo /etc/yum.repos.d/
[root@hwchefserver ~]# yum makecache
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB ::
extras | 3.4 kB ::
openlogic | 1.3 kB ::
packages-microsoft-com-mssql-server | 2.9 kB ::
packages-microsoft-com-prod | 2.9 kB ::
updates | 3.4 kB ::
(/): packages-microsoft-com-prod/filelists_db | 2.7 kB ::
(/): packages-microsoft-com-prod/other_db | kB ::
(/): packages-microsoft-com-prod/primary_db | 4.6 kB ::
Loading mirror speeds from cached hostfile
Metadata Cache Created
安装:
[root@hwchefserver ~]# yum install mssql-tools
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mssql-tools.x86_64 :14.0.1.246- will be installed
--> Processing Dependency: msodbcsql for package: mssql-tools-14.0.1.246-.x86_64
--> Running transaction check
---> Package msodbcsql.x86_64 :13.0.1.0- will be installed
--> Processing Dependency: unixODBC-utf16 for package: msodbcsql-13.0.1.0-.x86_64
--> Processing Dependency: libodbcinst.so.()(64bit) for package: msodbcsql-13.0.1.0-.x86_64
--> Running transaction check
---> Package unixODBC-utf16.x86_64 :2.3.- will be installed
--> Processing Dependency: libltdl.so.()(64bit) for package: unixODBC-utf16-2.3.-.x86_64
--> Running transaction check
---> Package libtool-ltdl.x86_64 :2.4.-.el7_2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Installing:
mssql-tools x86_64 14.0.1.246- packages-microsoft-com-prod k
Installing for dependencies:
libtool-ltdl x86_64 2.4.-.el7_2 updates k
msodbcsql x86_64 13.0.1.0- packages-microsoft-com-prod 3.8 M
unixODBC-utf16 x86_64 2.3.- packages-microsoft-com-prod k
Transaction Summary
===========================================================================================================================================================
Install Package (+ Dependent packages)
Total download size: 4.5 M
Installed size: 4.5 M
Is this ok [y/d/N]: y
Downloading packages:
(/): libtool-ltdl-2.4.-.el7_2.x86_64.rpm | kB ::
(/): msodbcsql-13.0.1.0-.x86_64.rpm | 3.8 MB ::
(/): mssql-tools-14.0.1.246-.x86_64.rpm | kB ::
(/): unixODBC-utf16-2.3.-.x86_64.rpm | kB ::
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 8.3 MB/s | 4.5 MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libtool-ltdl-2.4.-.el7_2.x86_64 /
Installing : unixODBC-utf16-2.3.-.x86_64 /
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746838 and found in
/usr/share/doc/msodbcsql/LICENSE.TXT . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
YES
Installing : msodbcsql-13.0.1.0-.x86_64 /
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
YES
Installing : mssql-tools-14.0.1.246-.x86_64 /
Verifying : libtool-ltdl-2.4.-.el7_2.x86_64 /
Verifying : msodbcsql-13.0.1.0-.x86_64 /
Verifying : unixODBC-utf16-2.3.-.x86_64 /
Verifying : mssql-tools-14.0.1.246-.x86_64 /
Installed:
mssql-tools.x86_64 :14.0.1.246-
Dependency Installed:
libtool-ltdl.x86_64 :2.4.-.el7_2 msodbcsql.x86_64 :13.0.1.0- unixODBC-utf16.x86_64 :2.3.-
Complete!
安装成功!
测试连接:
[root@hwchefserver ~]# sqlcmd -S localhost -U SA
Password:
登陆成功。
创建数据库test:
> create database test;
> go
> use test;
> go
Changed database context to 'test'.
查看数据库:
> select name from sys.databases;
> go
name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
test
创建表hwtable:
> create table hwtable ( id int, name varchar(), gender varchar(), age int);
> go
插入数据:
> insert into hwtable values (, 'weiheng','male',);
> go
查询:
> select * from hwtable;
> go
id name gender age
----------- -------------------- -------------------- -----------
weiheng male
( rows affected)
MSSQL Sever On Linux就这样安装完成了!
学习SQL Server从在Linux上安装开始的更多相关文章
- SQL Server on Ubuntu——Ubuntu上的SQL Server(全截图)
本文从零开始一步一步介绍如何在Ubuntu上搭建SQL Server 2017,包括安装系统.安装SQL等相关步骤和方法(仅供测试学习之用,基础篇). 一. 创建Ubuntu系统(Create U ...
- 在linux上安装 sql server for linux
在linux上安装 sql server for linux Install SQL Server on Red Hat Enterprise Linux Install SQL Server To ...
- 【BI学习笔记】在Linux上安装Wyn Enterprise商业智能报表服务器
在百度文库上找来的,放到这里,避免以后丢了. 葡萄城出品的Wyn Enterprise商业智能软件的设计器和查看视图是通过浏览器使用的,不需要安装专门的程序.Wyn Enterprise的服务器端可以 ...
- Configure Always On Availability Group for SQL Server on Ubuntu——Ubuntu上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...
- 怎样在 Ubuntu Linux 上安装 MySQL
本教程教你如何在基于 Ubuntu 的 Linux 发行版上安装 MySQL.对于首次使用的用户,你将会学习到如何验证你的安装和第一次怎样去连接 MySQL. -- Sergiu MySQL 是一个典 ...
- linux上安装配置samba服务器
linux上安装配置samba服务器 在linux上安装配置samba服务器 在这给大家介绍一个不错的家伙,samba服务.如果您正在犯愁,如何在Windows和Linux之间实现资源共享,就请看看这 ...
- 在Windows和Linux上安装paramiko模块以及easy_install的安装方法
一.paramiko模块有什么用? paramiko是用python语言写的一个模块,遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接.由于使用的是python这样的能够跨平台运行的语言 ...
- Sql Server 2008卸载后再次安装一直报错
sql server 2008卸载之后再次安装一直报错问题. 第一:由于上一次的卸载不干净,可参照百度完全卸载sql server2008 的方式 1. 用WindowsInstaller删除所有与S ...
- 在Linux上安装Oracle RAC 12 c(12.1) 虚拟机,一步一步向导
Oracle RAC 12 c(12.1)在Linux上安装虚拟机,一步一步向导 今天我们将看到如何安装 12 c版本1 RAC(真正的应用程序集群)数据库2 Linux 64位的虚拟机 使用VMWa ...
随机推荐
- Hearbeat + Nginx 安装配置
Hearbeat + Nginx 安装配置 实验环境 两台主机:Linux Centos 6.5 32位 主 服务端:Hearbeat + Nginx eth0:192.168.1.160(公网) e ...
- Guidelines for Successful SoC Verification in OVM/UVM
By Moataz El-Metwally, Mentor Graphics Cairo Egypt Abstract : With the increasing adoption of OVM/UV ...
- OWASP十大攻击类型详解
随着WEB应用技术的不断进步与发展,WEB应用程序承载了越来越多的业务,而随之而来的也是WEB应用所面临的越来越复杂的安全问题.而WEB日志作为WEB安全中的一个重要组成部分,不但可在事后起到追踪和溯 ...
- 20145240 《Java程序设计》第三次实验报告
20145240 <Java程序设计>第三次实验报告 北京电子科技学院(BESTI)实验报告 课程:Java程序设计 班级:1452 指导教师:娄嘉鹏 实验日期:2016.04.22 实验 ...
- INSPIRED启示录 读书笔记 - 第13章 产品原则
确定什么最重要 产品原则是对团队信仰和价值观的总结,用来指导产品团队作出正确的决策和取舍.它体现了产品团队的目标和愿景,是产品战略的重要组成部分.从形式上看,它是一系列明确的.体现团队特色的产品价值准 ...
- INSPIRED启示录 读书笔记 - 第9章 产品副经理
发现帮手 从本质上讲,产品就是创意,产品经理的职责是想出好点并加以实现.我们需要好点子,有些想法是我们自己的创意,但如果仅依靠自己,就会严重限制创意的发挥 做产品要找公司最聪明的人合作,发现公司里潜在 ...
- 一步一步粗谈linux文件系统(三)----超级块(superblock)【转】
本文转载自:https://blog.csdn.net/fenglifeng1987/article/details/8302921 超级块是来描述整个文件系统信息的,可以说是一个全局的数据结构,可以 ...
- QT 实现按住鼠标左键点击对话框空白处,拖动对话框
定义头文件 QPoint move_point; //移动的距离 bool mouse_press; //按下鼠标左键 protected: void mousePressEvent( ...
- review36
对于Thread(Runnable target)构造方法创建的线程,轮到它来享用CPU资源时,目标对象就会自动调用接口中的run()方法,因此,对于使用同一目标对象的线程,目标对象的成员变量自然就是 ...
- 太深了,梯度传不下去,于是有了highway。 干脆连highway的参数都不要,直接变残差,于是有了ResNet。 强行稳定参数的均值和方差,于是有了BatchNorm。RNN梯度不稳定,于是加几个通路和门控,于是有了LSTM。 LSTM简化一下,有了GRU。
请简述神经网络的发展史sigmoid会饱和,造成梯度消失.于是有了ReLU.ReLU负半轴是死区,造成梯度变0.于是有了LeakyReLU,PReLU.强调梯度和权值分布的稳定性,由此有了ELU,以及 ...