Windows 2016 server install SQL Server2019

download

https://www.microsoft.com/zh-cn/evalcenter/evaluate-sql-server-2019?filetype=EXE

If the URL is invalid, just search by search engine.

installation

Just click on the next step.

Deployment and configuration

After the installation is complete, begin to configure the database.

Configure username

Normally, sql authentication login is required, so we need to configure sa login.

Insert picture description here


Modify password

Insert picture description here


enable

Insert picture description here


modify server properties

Insert picture description here

Configure remote connection

After completing sa login, you need to configure remote login.

Insert picture description here


Configure firewall

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN

Create database

If there is an error, as follows

Insert picture description here


Execute sql

use master  --选择数据库
go
select spid from master.sys.sysprocesses where dbid = db_id('model');

--杀掉占用model数据库的进程
use master  --选择数据库
go
declare @sql varchar(100) 
while 1=1 
begin 
  select top 1 @sql = 'kill '+cast(spid as varchar(3)) 
  from master..sysprocesses where spid > 50 and spid <> @@spid and  dbid = db_id('model')
  if @@rowcount = 0 
    break ;
  print(@sql)   --打印杀掉进程语句
  exec(@sql)    --执行杀掉进程语句
end
go

database backup

The database is backed up to the server disk. Note: it cannot be backed up locally (if you are connected remotely)

Database restore

Restore after obtaining the backup database package

Need to download the driver (Microsoft® SQL Server® 2012 Native Client-QFE)

https://www.microsoft.com/zh-CN/download/details.aspx?id=50402

Insert picture description here