Install SQL Server in Centos 7.3, Centos
In the future, I will deal with Linux. I am lucky to be a loyal fan of. net in Linux, because. net core and asp.net core are already cross-platform. Today, it's okay to try the legendary Linux SQL server.
Install SQL Server to Centos 7.3
Official documents: https://docs.microsoft.com/en-us/ SQL /linux/quickstart-install-connect-red-hat
OS prerequisites:
|
|
Memory |
3.25 GB |
File System |
XFSOrEXT4(Other file systems, suchBTRFS, Are unsupported) |
Disk space |
6 GB |
Processor speed |
2 GHz |
Processor cores |
2 cores |
Processor type |
X64-compatible only |
cat /etc/redhat-release
1. Set the yum installation Source
curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo
2. Install Mssql server
yum install -y mssql-server
3. view the version and installation path.
rpm -qa | grep mssql
Find/-name mssql
4. Configure an SQL server account
cd /opt/mssql/bin
./Mssql. conf setup (you must stop Mssql-server to configure it)
Start the service
systemctl start mssql-serversystemctl enable mssql-server
5. Set firewall
firewall-cmd --add-port='1433/tcp' --permanentfirewall-cmd –reload
Install the command line management tool
1. Install the local client command line tool
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
yum install -y mssql-tools
2. Configure SqlCmd Environment Variables
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrcsource ~/.bashrc
3. view the database status
systemctl status mssql-server
If the startup fails, view the log information:
journalctl -u mssql-server.service -b
4. Connect to the database
sqlcmd -S localhost -U SA -P ''
5. Create and query a database
CREATE DATABASE DataTest;GOSELECT Name from sys.Databases;GO
6. General Database Operations (create tables, insert data, and query data)Summary
The installation steps are similar to those in the official documentation. It is easy to get started and install.