How to install and configure SQL Server in Centos 7.3
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:
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
(Mssql-server must be stopped for configuration)
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.repoyum install -y mssql-tools
2. Configure SqlCmd Environment Variables
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profileecho '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 Databases
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.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.