mssql windows 账户登录不了 要登录sa创建出来 才可以本地登录
SQL SERVER 登陆错误:18456
SQL Windows身份登录失败,错误码:18456
先用sa进入
EXEC xp_instance_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer', N'LoginMode'
-- 启用TCP/IP协议
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp', N'Enabled', REG_DWORD, 1
//查询登录账户
SELECT name,type_desc,is_disabled
FROM sys.server_principals
WHERE type_desc = 'WINDOWS_LOGIN' AND name = 'your_windows_account';
创建登录账户
CREATE LOGIN [LAPTOP-46N8T2QN\Administrator] FROM WINDOWS