Introduction to the installation and configuration of Linux for SQL Server under Centos 7.3
Speaking of SQL Server Services, we all know that Microsoft's database services, of course, the database, now mainly divided into three major business: 1:oracle, 2:msql Server, 3:mysql; three kinds of databases in the current environment can not be different degrees of concern , such as Oracle is mainly used in large-scale business, such as banks, SQL Server is mainly used in common Internet companies, MySQL is mainly for small enterprises or service providers, of course, the cost of Oracle is the most expensive, but also the most stable; SQL The server is also more expensive, but compared to Oracle a little lower, and finally we say that MySQL is often used by developers, but also managers often do testing to use, because it is free, good nonsense to say, and began to get to the point, we are today mainly about the CentOS 7.3 Install Linux for SQL server and configuration introduction, 2016 near the end of the Microsoft announced that a Linux can run under the SQL Server, of course, has been released, for the function and stability needs to be tested, today we first introduced the test, Later we will write Linux for SQL Server as a collection, as interested can refer to learning.
We know there are many ways to install services under Linux, the simplest is Yum installation, but a lot of services through Yum can not be installed, if you want to use Yum installation, you need to specify the Yum installation warehouse, we need to install mSQL Server today, so we need to specify Microsoft Yum source;
https://packages.microsoft.com/
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/48/wKioL1i8FlriE0EYAADME_J6O7I252.png" height= "331"/>
Environment Introduction: ip:192.168.5.20
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/48/wKioL1i8FluBqxTQAADVJCnK2Cc640.png" height= "158"/>
Version 7.3 Centos
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FlySUzZxAABFvfcwV3M992.png" height= "/>"
(1) Download the source of SQL Server for easy installation via Yum command
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/48/wKioL1i8Fl3ze81MAAEP8PTDIW8039.png" height= "287"/>
Curl Https://packages.microsoft.com/config/rhel/7/mssql-server.repo >/etc/yum.repos.d/mssql-server.repo
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/48/wKioL1i8Fl7BtI1XAABs4kiUmI8705.png" height= "/>"
We use the above command to follow Vim/etc/yum.repos.d/mssql-server.repo (create a Mysql-server.repo file under/ETC/YUM.REPOSE.D)
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "http://s3.51cto.com/wyfs02/M00/8E/48/wKioL1i8Fl-gcQ25AAA66VW7HBM931.png" height= "Si"/>
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/48/wKioL1i8Fl_SDvmEAACpc5-CTRc037.png" height= "198"/>
Start installing Msqlserver
Yum Install-y mssql-server
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FmCBRG7HAADDyRxp_4I051.png" height= "223"/>
Installation Complete
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/4B/wKiom1i8FmODSYCDAAEWVW_cKlA499.png" height= "311"/>
We view versions
Rpm-qa | grep MSSQL
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/4B/wKiom1i8FmPCJyEjAABUv6EZGtE764.png" height= "/>"
View Installation Road Strength
Find/-name MSSQL
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/48/wKioL1i8FmSi0wrSAAA1B0ZLUoM366.png" height= "/>"
We need to configure the prompts we have completed with MSSQL
Configure the/opt/mssql/bin/mssql-conf for the specific configuration
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/48/wKioL1i8FmXxXISsAACwobFNCD0797.png" height= "186"/>
Cd/opt/mssql/bin
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/48/wKioL1i8FmbBNW9BAAA-WPaxBU8196.png" height= "/>"
./mssql-conf
We just want to post a hint to add parameters later,
Then we execute./mssql-conf-h for help tips
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/48/wKioL1i8Fo_iNQtZAAEyx3YMWeI028.png" height= "261"/>
So we need to configure execution, execute the following command for SQL Server configuration
./mssql.conf Setup
We execute the process to set the MSSQL password to 123456 when prompted to say that the password does not conform to SQL Server Password policy, we need to set a complex password
The password for the system Administrator SA for SQL Server requires a minimum of 8 characters, a number, a non-alphanumeric symbol, and so on.
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/4B/wKiom1i8FpGCOy2iAAB-d28HPmU899.png" height= "94"/>
Re-execute the script
/mssql.conf Setup agrees to the license, enter Y, enter the SQL Server Administrator password (SA), and verify that you are prompted to complete
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/4B/wKiom1i8FpHhrGGqAACQUdwDvEA342.png" height= "/>"
Next we start the MSSQL service
Systemctl start Mssql-serversystemctl Enable Mssql-server
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FpPy7rAcAABIWzkq9fk758.png" height= "/>"
Then we look at the port status
SQL Server port 1433 is already being monitored.
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FpTT8S8LAAEXp90Prsg367.png" height= "228"/>
Set up a firewall
To connect to the database, first open the firewall on port 1433, that is, increase TCP port 1433 to the public area, and the permanent effect.
Firewall-cmd--add-port= ' 1433/tcp '--permanentfirewall-cmd--reload
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/49/wKioL1i8FpjB4fL8AABLwYGy_L0127.png" height= "/>"
Let's first connect through SQL Manager Studio under Windows
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/4B/wKiom1i8FpnjJ5wKAADewTocHf0532.png" height= "429"/>
Next we use Linux to connect locally, we first need to download the source of the client tools, install the client tools
Curl Https://packages.microsoft.com/config/rhel/7/prod.repo >/etc/yum.repos.d/msprod.repo
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/49/wKioL1i8FpqxBEd-AABT0a5Z_YQ143.png" height= "Up"/>
Yum Install-y Mssql-tools
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/4B/wKiom1i8FpvyQ2JWAAEW6761lO0753.png" height= "346"/>
Connecting to SQL Sever
Here you use SQLCMD to connect to SQL Server, and here are some command-line arguments. We have installed the exact prompt without this command
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "http://s3.51cto.com/wyfs02/M01/8E/49/wKioL1i8FpyA51bUAAAoQLXUFdY669.png" height= "Si"/>
We need to configure environment variables
echo ' Export path= ' $PATH:/opt/mssql-tools/bin "' >> ~/.bash_profile
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/49/wKioL1i8Fp2RHf-BAAA8d4QEP60763.png" height= "/>"
We can also use the shell for later use we need to add a variable
echo ' Export path= ' $PATH:/opt/mssql-tools/bin "' >> ~/.bashrcsource ~/.BASHRC
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8Fp3DDv9hAABKD-6WigM999.png" height= "/>"
Next we try to use the sqlcmd command again
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/4B/wKiom1i8FqChV0xLAAGVSC5HXAA105.png" height= "337"/>
Next we connect the database
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/49/wKioL1i8FqLzqxMSAAEkwgctE-8188.png" height= "405"/>
Here,-S is the specified server name,-u Specifies the user name, enter the password when prompted.
Sqlcmd-s localhost-u sa-p <Password>
Enter will prompt for password
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FqKxOgVyAAA90_GpJjA573.png" height= "135"/>
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/49/wKioL1i8FqbB81FNAACOHW9mXYo468.png" height= "355"/>
Querying all databases under the system
SELECT Name from Sys. Databases; GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/4B/wKiom1i8FqeC0HRNAAApHvZqFJU656.png" height= "101"/>
Create a database for TestDB
CREATE DATABASE TestDB; GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M01/8E/49/wKioL1i8FqfSDUFYAAAjmI71fzU875.png" height= "/>"
We look at all the databases under the system again
SELECT Name from Sys. Databases; GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FqjwrG0mAAA64V9fSGc857.png" height= "149"/>
Next we need to select the database
Use TestDB; GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/4B/wKiom1i8FqnDMTFKAAA1Pt6hw3s566.png" height= "/>"
Next we need to create a table with the name: TESTTB
CREATE TABLE TESTTB (id int, name NVARCHAR (), quantity INT); GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M02/8E/49/wKioL1i8FqqBhnbfAABIncNvH5Q859.png" height= "/>"
Then we insert the data into the table
INSERT into TESTTB values (1, ' banana ', "), insert into TESTTB values (2, ' orange ', 154); GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/49/wKioL1i8Fqvga5agAAB4x6bIQgE213.png" height= "154"/>
Next we query the information in the table
SELECT * from TESTTB; GO
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://s3.51cto.com/wyfs02/M00/8E/4B/wKiom1i8FqzCg3gdAABIuFu7p1U122.png" height= "/>"
Next we use SSMs under Windows to view
650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "border=" 0 "alt=" clipboard "Src=" Http://s3.51cto.com/wyfs02/M00/8E/49/wKioL1i8Fq3iRNVzAADMWrVJmsA954.png "height=" 321 "/>
Our next article will show you how to manage MSSQL Server using Powersell
This article from "Gao Wenrong" blog, declined reprint!
Introduction to the installation and configuration of Linux for SQL Server under Centos 7.3