Windows 上的 SQL Server(本地)
要在 Windows 计算机上本地运行 Microsoft SQL Server:
¥To run a Microsoft SQL Server locally on a Windows machine:
-
如果你无权访问 Microsoft SQL Server 实例,请下载并设置 SQL Server 2019 开发者。
¥If you do not have access to an instance of Microsoft SQL Server, download and set up SQL Server 2019 Developer.
-
下载并安装 SQL Server 管理工作室。
¥Download and install SQL Server Management Studio.
-
使用 Windows 身份验证登录 Microsoft SQL Server Management Studio(展开服务器名称下拉列表并单击 <浏览更多...> 查找你的数据库引擎):
¥Use Windows Authentication to log in to Microsoft SQL Server Management Studio (expand the Server Name dropdown and click <Browse for more...> to find your database engine):
启用 TCP/IP
¥Enable TCP/IP
Prisma 客户端需要启用 TCP/IP。要启用 TCP/IP:
¥Prisma Client requires TCP/IP to be enabled. To enable TCP/IP:
-
打开 SQL Server 配置管理器。(在“开始”菜单中搜索 "SQL Server 配置管理器",或打开“开始”菜单并键入 "SQL Server 配置管理器"。)
¥Open SQL Server Configuration Manager. (Search for "SQL Server Configuration Manager" in the Start Menu, or open the Start Menu and type "SQL Server Configuration Manager".)
-
在左侧面板中,单击 SQL Server 网络配置 > MSSQLSERVER 协议
¥In the left-hand panel, click SQL Server Network Configuration > Protocols for MSSQLSERVER
-
右键单击“TCP/IP”并选择“启用”。
¥Right-click TCP/IP and choose Enable.
使用 SQL 登录启用身份验证(可选)
¥Enable authentication with SQL logins (Optional)
如果你想在连接 URL 中使用用户名和密码而不是集成安全性,请 启用混合认证模式 如下:
¥If you want to use a username and password in your connection URL rather than integrated security, enable mixed authentication mode as follows:
-
在对象资源管理器中右键单击数据库引擎,然后单击属性。
¥Right-click on your database engine in the Object Explorer and click Properties.
-
在“服务器属性”窗口中,单击左侧列表中的“安全性”,勾选“SQL Server 和 Windows 身份验证模式”选项,然后单击“确定”。
¥In the Server Properties window, click Security in the left-hand list and tick the SQL Server and Windows Authentication Mode option, then click OK.
-
在对象资源管理器中右键单击数据库引擎,然后单击重新启动。
¥Right-click on your database engine in the Object Explorer and click Restart.
启用 sa
登录
¥Enable the sa
login
要启用默认的 sa
(管理员)SQL Server 登录名:
¥To enable the default sa
(administrator) SQL Server login:
-
在 SQL Server Management Studio 的对象资源管理器中,展开安全性 > 登录名,然后双击 sa。
¥In SQL Server Management Studio, in the Object Explorer, expand Security > Logins and double-click sa.
-
在“常规”页面上,为
sa
账户选择密码(如果你不想强制执行策略,请取消选中“强制执行密码策略”)。¥On the General page, choose a password for the
sa
account (untick Enforce password policy if you do not want to enforce a policy). -
在“状态”页面上的“设置”>“登录”下,勾选“已启用”,然后单击“确定”。
¥On the Status page, under Settings > Login, tick Enabled, then click OK.
现在,你可以在连接 URL 中以及登录 SQL Server Management Studio 时使用 sa
账户。
¥You can now use the sa
account in a connection URL and when you log in to SQL Server Management Studio.
注意:
sa
用户拥有广泛的权限。你也可以 使用更少的权限创建你自己的登录名。¥Note: The
sa
user has extensive permissions. You can also create your own login with fewer permissions.