源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Centos 7.3下SQL Server安装配置方法图文教程

  • 时间:2020-06-23 06:39 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Centos 7.3下SQL Server安装配置方法图文教程
以后工作都将与Linux打交道,对于.net忠实粉丝现在进入Linux还算幸运,因为.net core和asp.net core都已经跨平台了。今天没事想试试传说中的Linux Sql server是不是上手容易。 [b]安装SQL Server到Centos 7.3[/b] 官方文档:[url=https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-red-hat]https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-red-hat[/url] OS必须条件: [img]http://files.jb51.net/file_images/article/201708/201782194957925.jpg?20177219508[/img]
cat /etc/redhat-release
[img]http://files.jb51.net/file_images/article/201708/201708210944337.png[/img] 1、设置yum安装源
curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo
2、安装Mssql server
yum install -y mssql-server
[img]http://files.jb51.net/file_images/article/201708/201708210944338.png[/img] 3、查看版本和安装路径
rpm -qa | grep mssql
[img]http://files.jb51.net/file_images/article/201708/201708210944339.png[/img]
find / -name mssql
[img]http://files.jb51.net/file_images/article/201708/2017082109443310.png[/img] 4、配置Sql server管理账户
cd /opt/mssql/bin
[img]http://files.jb51.net/file_images/article/201708/2017082109443411.png[/img]
./mssql.conf setup 
(必须停止Mssql-server才能配置) [img]http://files.jb51.net/file_images/article/201708/2017082109443412.png[/img] 启动服务
systemctl start mssql-server
systemctl enable mssql-server
5、设置防火墙
firewall-cmd --add-port='1433/tcp' --permanent
firewall-cmd –reload
[b]安装命令行管理工具[/b] 1、安装本地客户端命令行工具
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
yum install -y mssql-tools
[img]http://files.jb51.net/file_images/article/201708/2017082109443413.png[/img] 2、配置SqlCmd环境变量
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
[img]http://files.jb51.net/file_images/article/201708/2017082109443414.png[/img] 3、查看数据库状态
systemctl status mssql-server
[img]http://files.jb51.net/file_images/article/201708/2017082109443415.png[/img] 如果启动不成功查看日志信息: journalctl -u mssql-server.service -b 4、连接数据库
sqlcmd -S localhost -U SA -P ''
[img]http://files.jb51.net/file_images/article/201708/2017082109443416.png[/img] 5、创建数据库并查询
CREATE DATABASE DataTest;
GO
SELECT Name from sys.Databases;
GO
[img]http://files.jb51.net/file_images/article/201708/2017082109443417.png[/img] 6、一般数据库操作(创建表,插入数据,查询数据) [img]http://files.jb51.net/file_images/article/201708/2017821100017070.jpg?201772110027[/img] [b]总结[/b] 安装步骤和官方文档的差不多,上手和安装都挺简单的。 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部