红联Linux门户
Linux帮助

KaliLinux安装SqlServer数据库

发布时间:2017-03-09 15:13:09来源:linux网站作者:root__1024
官方给出了ubuntu、redhut、suse的安装方式,想想kali和ubuntu都是基于debian的Linux,也是可以安装的。
 
1、安装与卸载
官方地址:https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-ubuntu
如果遇到依赖软件版本不对,则安装相应的即可,比如我的openssl是1.1.10的,但太高了,所以需要降级。
下列软件包有未满足的依赖关系:
mssql-server : 依赖: openssl (<= 1.1.0)
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系
降就降嘛:
# apt-get install openssl=1.0.\*
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
为 openssl 选定了版本 1.0.1k-3+deb8u1 (kali-next [amd64])
下列软件包将被【降级】:
openssl
....
# openssl version -a
OpenSSL 1.0.1k 8 Jan 2015 (Library: OpenSSL 1.0.2d 9 Jul 2015)
built on: reproducible build, date unspecified
platform: debian-amd64
装好之后:
正在设置 libc++1:amd64 (3.9.0-2) ...
正在设置 mssql-server (14.0.304.138-1) ...
KaliLinux安装SqlServer数据库
然后设一个复杂的密码:
# /opt/mssql/bin/mssql-conf setup
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? [Yes/No]:y
Setting up Microsoft SQL Server
Enter the new SQL Server system administrator password: 
The specified password does not meet SQL Server password policy requirements because it is too short. The password must be at least 8 characters
 
2、服务操作
开启关闭之类的:
sudo systemctl stop mssql-server
sudo systemctl start mssql-server
sudo systemctl restart mssql-server
查看状态
sudo systemctl status mssql-server
参考:https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-troubleshooting-guide#connection
这样:
# systemctl status mssql-server
mssql-server.service - Microsoft(R) SQL Server(R) Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor pre
Active: active (running) since Thu 2017-03-09 13:44:14 CST; 52s ago
 Main PID: 22431 (sqlservr)
CGroup: /system.slice/mssql-server.service
    ├─22431 /opt/mssql/bin/sqlservr
    └─22506 /opt/mssql/bin/sqlservr
 
3、连接与操作
官方地址:
先安装sqlcmd工具
https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-tools#ubuntu
再连接:
https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-connect-and-query-sqlcmd
看一下端口号1433:
# lsof -i :1433
KaliLinux安装SqlServer数据库
我使用sqlcmd总是超时,所以我使用了另一个工具sqsh:
# sqsh -S localhost -U sa
sqsh-2.1.7 Copyright (C) 1995-2001 Scott C. Gray
Portions Copyright (C) 2004-2010 Michael Peppler
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
Password: 
1> select Name from sys.Databases
2> go
 
本文永久更新地址:http://www.linuxdiyf.com/linux/29043.html