Python - 无法连接到 MS SQL

Python - Can't connect to MS SQL

当我尝试连接到 MS SQL 时,出现此错误:

> pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC Driver 13 for SQL
> Server]SQL Server Network Interfaces: Error Locating Server/Instance
> Specified [xFFFFFFFF].  (-1) (SQLDriverConnect); [HYT00]
> [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0);
> [08001] [Microsoft][ODBC Driver 13 for SQL Server]A network-related or
> instance-specific error has occurred while establishing a connection
> to SQL Server. Server is not found or not accessible. Check if
> instance name is correct and if SQL Server is configured to allow
> remote connections. For more information see SQL Server Books Online.
> (-1)')

如何解决这个错误并最终连接到数据库?

在我的案例中,通过在服务中激活 SQL Server (SQLEXPRESS) 解决了这个问题。原来,电脑启动的时候并没有自动开机