SQL Server on Linux 2017 (sql-server function application under Linux)

Source: Internet
Author: User
Tags curl mssql management studio sql server management sql server management studio

Installation Environment CENTOS7:
Official installation of necessary conditions:
RHEL 7.3 or 7.4 machine must have at least 2 GB of memory

1, set Mssql_server of the official Yum Source:
Curl-o/etc/yum.repos.d/mssql-server.repo Https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo

2. Install SQL Server by running the following command:
Yum Install-y mssql-server

3. After the package installation is complete, run the MSSQL conf installation command and follow the instructions to set the SA password and select your version
[[email protected] ~]#/opt/mssql/bin/mssql-conf Setup


Prompt for license:


Prompt to select language support:

Installation error, indicating that the memory is too small to meet the requirements.

Upgrade the system memory (re-perform the installation steps above) to install:

Prompt for installation success.

To see if the service port is open:
[Email protected] ~]# SS-TNL

To add a firewall:
[Email protected] ~]# firewall-cmd--zone=public--add-port=1433/tcp--permanent
Success
[Email protected] ~]# Firewall-cmd--reload
Success
[Email protected] ~]#

Installing SQL Server command-line tools
You also need to set up an official installation source:
Curl-o/etc/yum.repos.d/msprod.repo Https://packages.microsoft.com/config/rhel/7/prod.repo

Tip: If you have previous versions of MSSQL tools installed, please remove any older UnixODBC packages
Run the following command to install the MSSQL tool with the UnixODBC developer pack.
[email protected] ~]# Yum install-y mssql-tools unixodbc-devel

For convenience, add/opt/mssql-tools/bin/to your PATH variable. This allows you to run the tool without specifying the full path. Run the following command in the logon session and the interactive/non-logon session to modify the path:
[[email protected] ~]# echo ' Export path= ' $PATH:/opt/mssql-tools/bin ' ' >> ~/.bash_profile
[[email protected] ~]# echo ' Export path= ' $PATH:/opt/mssql-tools/bin ' ' >> ~/.BASHRC
[Email protected] ~]# source ~/.BASHRC

Sqlcmd is just a tool for connecting to SQL Server and running queries and performing management and development tasks. Other tools include:
? SQL Server Operations Studio (preview)
? SQL Server Management Studio
? Visual Studio Code.
? MSSQL-CLI (preview)
Use SQLCMD to connect locally to the new instance of SQL Server.
[Email protected] ~]# sqlcmd-s 192.168.26.210-u sa–p


To create a database:

View all databases:
SELECT Name from Sys. Databases

To create a table insert data:
1> CREATE TABLE emp (id int,name nvarchar (50))
2> Go
2> INSERT INTO EMP values (1001, ' Jerry ') and insert into EMP values (1002, ' Loki ')
3> Go

To view the data just entered:
1> select * from EMP;
2> Go

Default data storage path:


Since Sql-server has been supported by Linux, Sql-server's database is highly available for equalization, data backup, and so on, and the architecture is easier to implement, and the solution becomes richer and more diversified. Personally, the future of Linux and many applications under Windows will enter the era of great integration, complementary and interlinked.

SQL Server on Linux 2017 (sql-server function application under Linux)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.