- Изменение режима проверки подлинности сервера Change server authentication mode
- Перед началом Before you begin
- Изменение режима проверки подлинности с помощью SSMS Change authentication mode with SSMS
- Включение имени входа sa Enable sa login
- использование SSMS; Use SSMS
- Использование Transact-SQL Using Transact-SQL
- Изменение режима проверки подлинности (T-SQL) Change authentication mode (T-SQL)
- Unable to login to SQL Server + SQL Server Authentication + Error: 18456
- 7 Answers 7
- Windows authentication trusted connection not working
- 3 Answers 3
- Symptoms
- Resolution
- Scenario 1:
- Scenario 2:
- Scenario 3:
- Изменение режима проверки подлинности сервера Change server authentication mode
- Перед началом Before you begin
- Изменение режима проверки подлинности с помощью SSMS Change authentication mode with SSMS
- Включение имени входа sa Enable sa login
- использование SSMS; Use SSMS
- Использование Transact-SQL Using Transact-SQL
- Изменение режима проверки подлинности (T-SQL) Change authentication mode (T-SQL)
Изменение режима проверки подлинности сервера Change server authentication mode
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions)
В этом разделе описывается, как изменить режим проверки подлинности сервера в SQL Server SQL Server с помощью среды SQL Server Management Studio SQL Server Management Studio или Transact-SQL Transact-SQL . This topic describes how to change the server authentication mode in SQL Server SQL Server by using SQL Server Management Studio SQL Server Management Studio or Transact-SQL Transact-SQL . В процессе установки компонент Компонент SQL Server Database Engine SQL Server Database Engine настраивается на использование режима проверки подлинности Windows или режима проверки подлинности SQL Server и Windows. During installation, Компонент SQL Server Database Engine SQL Server Database Engine is set to either Windows Authentication mode or SQL Server and Windows Authentication mode. После установки вы можете изменить режим проверки подлинности в любое время. After installation, you can change the authentication mode at any time.
Если во время установки был выбран Режим проверки подлинности Windows , то имя входа sa отключено, а пароль присваивается программой установки. If Windows Authentication mode is selected during installation, the sa login is disabled and a password is assigned by setup. Если впоследствии изменить режим проверки подлинности на проверку подлинности SQL Server и Windows, то имя входа sa останется отключенным. If you later change authentication mode to SQL Server and Windows Authentication mode, the sa login remains disabled. Чтобы можно было пользоваться именем входа sa, включите его и присвойте ему новый пароль с помощью инструкции ALTER LOGIN. To use the sa login, use the ALTER LOGIN statement to enable the sa login and assign a new password. Имя входа sa может подключаться к серверу только с использованием проверки подлинности SQL Server SQL Server . The sa login can only connect to the server by using SQL Server SQL Server Authentication.
Перед началом Before you begin
Учетная запись sa — хорошо известная учетная запись SQL Server SQL Server и часто становится мишенью злоумышленников. The sa account is a well known SQL Server SQL Server account and it is often targeted by malicious users. Не включайте учетную запись sa, если это не требуется для работы приложения. Do not enable the sa account unless your application requires it. Для имени входа sa очень важно использовать надежный пароль. It is important that you use a strong password for the sa login.
Изменение режима проверки подлинности с помощью SSMS Change authentication mode with SSMS
В обозревателе объектов среды SQL Server Management Studio SQL Server Management Studio щелкните правой кнопкой мыши сервер и выберите пункт Свойства. In SQL Server Management Studio SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
На странице Безопасность , в разделе Серверная проверка подлинности выберите новый режим проверки подлинности сервера, а затем нажмите кнопку ОК. On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
В диалоговом окне среды SQL Server Management Studio SQL Server Management Studio нажмите кнопку ОК , чтобы подтвердить необходимость перезапуска SQL Server SQL Server . In the SQL Server Management Studio SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server SQL Server .
В обозревателе объектов щелкните правой кнопкой мыши сервер и выберите пункт Перезапустить. In Object Explorer, right-click your server, and then click Restart. Если работает агент SQL Server SQL Server , он тоже должен быть перезапущен. If SQL Server SQL Server Agent is running, it must also be restarted.
Включение имени входа sa Enable sa login
Имя входа sa можно включить с помощью SSMS или T-SQL. You can enable the sa login with SSMS or T-SQL.
использование SSMS; Use SSMS
В обозревателе объектов разверните узел Безопасность, разверните «Имена входа», щелкните правой кнопкой мыши имя входа sa и выберите Свойства. In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
На вкладке Общие, возможно, придется создать и подтвердить пароль для имени входа sa. On the General page, you might have to create and confirm a password for the sa login.
На странице Состояние в разделе Имя входа щелкните Включить и нажмите кнопку ОК. On the Status page, in the Login section, click Enabled, and then click OK.
Использование Transact-SQL Using Transact-SQL
В следующем примере включается имя входа sa и устанавливается новый пароль. The following example enables the sa login and sets a new password. Замените надежным паролем. Replace with a strong password before you run it.
Изменение режима проверки подлинности (T-SQL) Change authentication mode (T-SQL)
В следующем примере проверка подлинности сервера переключается со смешанного режима (Windows + SQL) на Windows. The following example changes Server Authentication from mixed mode (Windows + SQL) to Windows only.
В следующем примере для изменения реестра сервера используется расширенная хранимая процедура. The following example uses an extended stored procedure to modify the server registry. При неправильном изменении реестра могут возникнуть серьезные проблемы. Serious problems might occur if you modify the registry incorrectly. В результате может потребоваться переустановка операционной системы. These problems might require you to reinstall the operating system. Корпорация Майкрософт не гарантирует, что эти проблемы можно устранить. Microsoft cannot guarantee that these problems can be resolved. Ответственность за изменение реестра лежит на пользователе. Modify the registry at your own risk.
Для изменения режима аутентификации необходимы разрешения системного администратора или сервера контроля The permissions required to change the authentication mode are sysadmin or Control Server
Unable to login to SQL Server + SQL Server Authentication + Error: 18456
I have created login account on my localhost\sql2008 Server (Eg. User123)
Mapped to Database (default)
Authentication Mode on SQL Server is set to both (Windows and SQL)
But login to SQL Server fails with following message (for User123)
Note: Have checked multiple time that UserName / Password are typed in correctly
Login failed for user ‘User123’ (Net.SqlClient Data Provider)
Server Name : localhost\sql2008 Error Number: 18456 Severity : 14 State : 1 Line Number : 65536
any help on this please.
7 Answers 7
By default login failed error message is nothing but a client user connection has been refused by the server due to mismatch of login credentials. First task you might check is to see whether that user has relevant privileges on that SQL Server instance and relevant database too, thats good. Obviously if the necessary prvileges are not been set then you need to fix that issue by granting relevant privileges for that user login.
Althought if that user has relevant grants on database & server if the Server encounters any credential issues for that login then it will prevent in granting the authentication back to SQL Server, the client will get the following error message:
Ok now what, by looking at the error message you feel like this is non-descriptive to understand the Level & state. By default the Operating System error will show ‘State’ as 1 regardless of nature of the issues in authenticating the login. So to investigate further you need to look at relevant SQL Server instance error log too for more information on Severity & state of this error. You might look into a corresponding entry in log as:
As defined above the Severity & State columns on the error are key to find the accurate reflection for the source of the problem. On the above error number 8 for state indicates authentication failure due to password mismatch. Books online refers: By default, user-defined messages of severity lower than 19 are not sent to the Microsoft Windows application log when they occur. User-defined messages of severity lower than 19 therefore do not trigger SQL Server Agent alerts.
Sung Lee, Program Manager in SQL Server Protocols (Dev.team) has outlined further information on Error state description:The common error states and their descriptions are provided in the following table:
You can see there is no severity or state level defined from that SQL Server instance’s error log. So the next troubleshooting option is to look at the Event Viewer’s security log [edit because screen shot is missing but you get the
idea, look in the event log for interesting events].
Windows authentication trusted connection not working
MSSQL Server is in the «abc» domain and have mixed mode authentication. I am connecting from the machine which is not in domain or in a domain «xyz» but with in the same network using MSSQL Jdbc driver 2.0. I have logged in as admin or account in xyz domain.
It works fine using following url for connection for «sa» or SQL Mode Authentication.
It doesn’t work For window authentication using credential «MSSQLDomain\username» i.e «abc\username» , using following url
Gives following error. Login failed for user ». The user is not associated with a trusted SQL Server connection.
I have tried adding property Trusted_Connection=Yes to url, but still gives same error. I don’t want to map the drive of the SQL Server. I am able to access the any shared folder of the SQL Server Machine by providing «MSSQLDomain\username» and password.
It works fine for both authentication mode, if both machine is in same domain. If I am using jtDS Driver from the machine which is not in domain or in «xyz» domain within same network i.e same subnet, it works fine.
3 Answers 3
This is the deliberate and correct behaviour of Windows Authentication.
It is because the Domain from which you are connecting from, is not the same Windows Domain as the one where your SQL Server instance resides.
I believe there are methods for bridging the Domains so to speak, however they require custom and tricky implementation. You also will have to configure a trust relationship between the domains.
The following thread contains discussions which you will likely find useful.
Changing the login credentials might help, use SQL authentication instead of nt authentication
Symptoms
After you install Microsoft SQL Server 2014, SQL Server 2012, SQL Server 2008, SQL Server 2005, or SQL Server 2000 and you try to connect to the server that is running SQL Server, you receive one of the following error messages:
Login failed for user ‘%.*ls’. The login is a SQL Server login and cannot be used with Windows Authentication.%.*ls
Login failed for user ». The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
Login failed for user ». (Microsoft SQL Server, Error: 18456)
Resolution
This problem occurs if the user tries to log in with credentials that cannot be validated. This problem can occur in the following scenarios:
Scenario 1:
The login may be a SQL Server login but the server only accepts Windows Authentication
To resolve this issue, configure SQL Server in Mixed Authentication Mode.
Scenario 2:
You are trying to connect by using SQL Server Authentication but the login used does not exist on SQL Server
To resolve this issue, verify that the SQL Server login exists. For more information, see Create a login in SQL Server Books Online.
Scenario 3:
The login may use Windows Authentication but the login is an unrecognized Windows principal
An unrecognized Windows principal means that Windows can’t verify the login. This might be because the Windows login is from an untrusted domain. To resolve this issue, verify that you are logged in to the correct domain.
I have been involved with making a SQL server connection cross to domains like that, and it is exceptionally painful. In order to use credentials from another domain, the domain where you are assigning the permissions has to trust the domain, where the account is coming from. IT Pro’s are generally VERY reluctant to trust another domain in this manner, and for good reason, so if this trust relationship has not been established it might not be very likely to convince the admins to do this.
Once you have the trust relationship established, you will probably need to register the SPN’s for your SQL server in Active Directory, and assign delegation permissions. This type of environment is very difficult to setup, troubleshoot and maintain.
I hope that there is some other way that you can do this, because it sounds like you are headed for a very difficult scenario.
Изменение режима проверки подлинности сервера Change server authentication mode
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions)
В этом разделе описывается, как изменить режим проверки подлинности сервера в SQL Server SQL Server с помощью среды SQL Server Management Studio SQL Server Management Studio или Transact-SQL Transact-SQL . This topic describes how to change the server authentication mode in SQL Server SQL Server by using SQL Server Management Studio SQL Server Management Studio or Transact-SQL Transact-SQL . В процессе установки компонент Компонент SQL Server Database Engine SQL Server Database Engine настраивается на использование режима проверки подлинности Windows или режима проверки подлинности SQL Server и Windows. During installation, Компонент SQL Server Database Engine SQL Server Database Engine is set to either Windows Authentication mode or SQL Server and Windows Authentication mode. После установки вы можете изменить режим проверки подлинности в любое время. After installation, you can change the authentication mode at any time.
Если во время установки был выбран Режим проверки подлинности Windows , то имя входа sa отключено, а пароль присваивается программой установки. If Windows Authentication mode is selected during installation, the sa login is disabled and a password is assigned by setup. Если впоследствии изменить режим проверки подлинности на проверку подлинности SQL Server и Windows, то имя входа sa останется отключенным. If you later change authentication mode to SQL Server and Windows Authentication mode, the sa login remains disabled. Чтобы можно было пользоваться именем входа sa, включите его и присвойте ему новый пароль с помощью инструкции ALTER LOGIN. To use the sa login, use the ALTER LOGIN statement to enable the sa login and assign a new password. Имя входа sa может подключаться к серверу только с использованием проверки подлинности SQL Server SQL Server . The sa login can only connect to the server by using SQL Server SQL Server Authentication.
Перед началом Before you begin
Учетная запись sa — хорошо известная учетная запись SQL Server SQL Server и часто становится мишенью злоумышленников. The sa account is a well known SQL Server SQL Server account and it is often targeted by malicious users. Не включайте учетную запись sa, если это не требуется для работы приложения. Do not enable the sa account unless your application requires it. Для имени входа sa очень важно использовать надежный пароль. It is important that you use a strong password for the sa login.
Изменение режима проверки подлинности с помощью SSMS Change authentication mode with SSMS
В обозревателе объектов среды SQL Server Management Studio SQL Server Management Studio щелкните правой кнопкой мыши сервер и выберите пункт Свойства. In SQL Server Management Studio SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
На странице Безопасность , в разделе Серверная проверка подлинности выберите новый режим проверки подлинности сервера, а затем нажмите кнопку ОК. On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
В диалоговом окне среды SQL Server Management Studio SQL Server Management Studio нажмите кнопку ОК , чтобы подтвердить необходимость перезапуска SQL Server SQL Server . In the SQL Server Management Studio SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server SQL Server .
В обозревателе объектов щелкните правой кнопкой мыши сервер и выберите пункт Перезапустить. In Object Explorer, right-click your server, and then click Restart. Если работает агент SQL Server SQL Server , он тоже должен быть перезапущен. If SQL Server SQL Server Agent is running, it must also be restarted.
Включение имени входа sa Enable sa login
Имя входа sa можно включить с помощью SSMS или T-SQL. You can enable the sa login with SSMS or T-SQL.
использование SSMS; Use SSMS
В обозревателе объектов разверните узел Безопасность, разверните «Имена входа», щелкните правой кнопкой мыши имя входа sa и выберите Свойства. In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
На вкладке Общие, возможно, придется создать и подтвердить пароль для имени входа sa. On the General page, you might have to create and confirm a password for the sa login.
На странице Состояние в разделе Имя входа щелкните Включить и нажмите кнопку ОК. On the Status page, in the Login section, click Enabled, and then click OK.
Использование Transact-SQL Using Transact-SQL
В следующем примере включается имя входа sa и устанавливается новый пароль. The following example enables the sa login and sets a new password. Замените надежным паролем. Replace with a strong password before you run it.
Изменение режима проверки подлинности (T-SQL) Change authentication mode (T-SQL)
В следующем примере проверка подлинности сервера переключается со смешанного режима (Windows + SQL) на Windows. The following example changes Server Authentication from mixed mode (Windows + SQL) to Windows only.
В следующем примере для изменения реестра сервера используется расширенная хранимая процедура. The following example uses an extended stored procedure to modify the server registry. При неправильном изменении реестра могут возникнуть серьезные проблемы. Serious problems might occur if you modify the registry incorrectly. В результате может потребоваться переустановка операционной системы. These problems might require you to reinstall the operating system. Корпорация Майкрософт не гарантирует, что эти проблемы можно устранить. Microsoft cannot guarantee that these problems can be resolved. Ответственность за изменение реестра лежит на пользователе. Modify the registry at your own risk.
Для изменения режима аутентификации необходимы разрешения системного администратора или сервера контроля The permissions required to change the authentication mode are sysadmin or Control Server