未加星标

Install and Configure SQL Server vNext on Linux Azure VM

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏
In my [ previous blog ] post we saw how to Create a new linux VM on Azure . After creating it we connected it from a windows workstation by using PuYYT tool and tested one Unix command.

Here in this post we will see how we can install SQL Server on Linux .

Microsoft is working on a new SQL Server vNext version that will work both on Windows as well as Linux. So with the recent [ CTP 1.x ] release we can see how does it look like on both the Operating Systems and get some hands on with it. > Get the Repository and Install SQL Server:

1. Import the public repository GPG keys:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add

2. Register the Microsoft SQL Server Ubuntu repository:

curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

3. Re-synchronize the Package index files from their sources, to get information of the newest versions of packages and their dependencies, and finally Install MSSQL-Server package :

sudo apt-get update

sudo apt-get install -y mssql-server

After Install it will ask you to run SQL Server setup by following message:

Please run /opt/mssql/bin/sqlservr-setup to complete the setup of Microsoft(R) SQL Server(R)

4. Now post install, we need to configure SQL Server and set the SA password, and SQL services.

sudo /opt/mssql/bin/sqlservr-setup

The Configuration gives following prompts in between:

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

5. Post Configuration you can verify that the service is running:

systemctl status mssql-server


Install and Configure SQL Server vNext on Linux Azure VM

2. Update sources list

> Install Tools:This will install the command-line tools (sqlcmd & BCP), Microsoft ODBC drivers, and their dependencies.

6. Re-synchronize the Package index files, and Install MSSQL-Tools :

sudo apt-get update

sudo apt-get install mssql-tools

> Connect to SQL instance:

9. We will use sqlcmd to connect to SQL Server vNext on our Linux VM. Run the sqlcmd command with following params:

S: Server Name

U: User Name

P: Password

sqlcmd -S localhost -U SA -P ”

> Run SQL Queries:

10. Now after connecting to the SQL Linux instance, let’s test come queries:

We will check the Version of SQL Server and list out system Databases :

select @@version
go
select database_id, name, create_date from sys.databases
go

Output of version statement:

Microsoft SQL Server vNext (CTP1.1) 14.0.100.187 (X64)

Dec 10 2016 02:51:11

Copyright (C) 2016 Microsoft Corporation. All rights reserved.

on Linux (Ubuntu 16.04.1 LTS)


Install and Configure SQL Server vNext on Linux Azure VM

SQL Version and System Databases

11. Let’s do more and Create a new Database, new Table and insert some sample records:

CREATE DATABASE SQLdbOnLinux
go
use SQLdbOnLinux
go
--Changed database context to 'SQLdbOnLinux'.
CREATE TABLE Test (i int, name varchar(25))
go
insert into Test values (1, 'Manoj')
insert into Test values (2, 'Saurabh')
go
--(1 rows affected)
--(1 rows affected)
select * from Test
go
--i name
------------- -------------------------
-- 1 Manoj
-- 2 Saurabh
--(2 rows affected)
Install and Configure SQL Server vNext on Linux Azure VM

Create a sample Database, a Table, and insert records

I think you would get amazed like me after using SQL Server on a Linux environment.

In my [ next post ] I’ll show how we can connect this SQL Linux instance from a Windows workstation via SSMS !!!

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: SQLLinuxWindowsSQL ServerUbuntu
分页:12
转载请注明
本文标题:Install and Configure SQL Server vNext on Linux Azure VM
本站链接:http://www.codesec.net/view/519903.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(52)