CentOS7 install and use SQL Server

CentOS7 install and use SQL Server

SQL Server Installation Guide on Linux##

The author is based on CentOS7 for installation

 sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server.repo
sudo yum update -y
sudo yum install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup

![ Picture description][1]

Ensure that the SA account password slightly meets the default requirements (at least 8 characters, including uppercase and lowercase letters, decimal numbers, and/or non-alphanumeric symbols)

systemctl status mssql-server

![ Picture description][2]

sudo firewall-cmd --zone=public--add-port=1433/tcp --permanent
sudo firewall-cmd --reload
# firewall-cmd is not enabled, no need to do this setting

So far, SQL Server has been running normally on CentOS7

Install SQL Server command line tools###

To create a database, you need to use a tool that can run Transact-SQL statements on SQL Server to connect. The following steps install SQL Server command line tools: sqlcmd and bcp

sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
sudo yum update
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
sudo yum update
sudo yum install -y mssql-tools unixODBC-devel
echo 'export PATH="$PATH:/opt/mssql-tools/bin"'>>~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"'>>~/.bashrc
source ~/.bashrc

Local connection configuration###

The following steps use sqlcmd to connect locally to a new SQL Server instance

sqlcmd -S localhost -U SA -P '<YourPassword>'

Password input can be interactive

![ Picture description][3]

Use SQL Server to create and query data###

Create a new database, create a database named AniuDB

CREATE DATABASE AniuDB
SELECT Name from sys.Databases
GO

![ Picture description][4]

Next create a new table itdevops, and then insert two new rows

USE AniuDB
CREATE TABLE itdevops(id INT, name NVARCHAR(50), quantity INT)
INSERT INTO itdevops VALUES(1,'banana',150); INSERT INTO itdevops VALUES(2,'orange',100);
GO

Select data, run query to return data from itdevops

  • Enter a query through the sqlcmd command prompt to return the rows in the itdevops table with a number greater than 100
SELECT * FROM itdevops WHERE quantity >100;
# Execute GO
quit

Connect from Windows###

The SQL Server tool on Windows connects to the SQL Server instance on Linux in the same way as connecting to any remote SQL Server instance

SSMS: https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-develop-use-ssms
WP: https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-manage-powershell
SSDT: https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-develop-use-ssdt

Recommended Posts

CentOS7 install and use SQL Server
CentOS7.3 install iptables and detailed use
Install and use docker under CentOS 6.8
Install centos7 and connect
How to install and use Docker on CentOS 7
How to install and use Composer on CentOS 8
How to install and use Curl on CentOS 8
centos7 install python3 and ipython
Know Linux and install CentOS
CentOs7.3 compile and install Nginx 1.9.9
CentOS 7 install Mono and MonoDevelop
CentOS6.5 install Java 8 and Tomcat8
Centos6.5 install and configure mongodb
centos7 kvm installation and use
CentOS7 install python3 and pip3
CentOS7 install OracleJDK and JRE
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack Jira 7
CentOS6.5 install Java 8 and Tomcat8
CentOS7 postgresql installation and use
Centos7 compile and install ntp-4.2.8p11
CentOS 6.9 compile and install python
CentOS6 install and crack confluence
CentOS 6 compile and install python 3
install virtualbox on centos server
CentOS6 install and crack Jira 7
Install Nginx server on CentOS 7
Centos7 elk7.1.1 installation and use
Centos 7 install jdk and package service service
CentOS7 yum install and start mysql
Install and configure keepalived under CentOS 5.9
Install and use dig under ubuntu/debian
CentOS Yum compile and install MySQL 5.6
Compile and install LAMP under Centos 5.2
CentOS 8 install Git and basic configuration
Use Nginx and u under CentOS
Tencent Cloud Centos7 install java server
How to install and configure Postfix mail server on CentOS8
CentOS 6.x compile and install Nginx
Install Percona Server database (in CentOS 8)
CentOS7 compile and install L(A|N)MP environment
CentOS quickly install Python3 and pip3
CentOS7 yum install and start mysql
CentOS 8 - install and configure NFS service
Centos7 uninstall openJdk, and install JDK1.8
Install Python3 and ansible under CentOS8
CentOS NTP server installation and configuration
CentOS Minimal install and configure TIPS
CentOS 7 install gogs git code server
Install Python3 and Py under CentOS7
Install and configure FreeIPA in Centos7
Linux CentOS6 compile and install Pyt
Use VMware15 to install Linux (CentOS6.5)
virtualBox install centos, and build tomcat
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Detailed steps to install virtual machines with VMware 15 and use CentOS 8
Use CentOS 7.5 to uninstall the built-in jdk and install your own JDK1.8
Install Gnome and VNC on Ubuntu Server
Compile and install libmodbus library under CentOS7
Installation and use of Mysql under CentOS
CentOS7.5 source code compile and install mysql5.7.29