Ошибка 18452 sql server

В статье описывается сообщение об ошибке "Ошибка 18452. Пользователь не связан с доверенным соединением SQL Server.", которая происходит во время процесса входа в SQL. Это происходит, если SQL Server настроен для работы в режиме проверки подлинности Windows. Режим проверки подлинности Windows – это режим безопасности по умолчанию после типичной установки SQL Server. В статье приводится решение.

SQL Server 2012 Standard SQL Server 2012 Enterprise SQL Server 2012 Developer SQL Server 2012 Express SQL Server 2012 Web SQL Server 2008 Standard SQL Server 2008 Enterprise SQL Server 2008 Developer SQL Server 2008 Express SQL Server 2008 Workgroup SQL Server 2008 Web Microsoft SQL Server 2005 Standard Edition Microsoft SQL Server 2005 Developer Edition Microsoft SQL Server 2005 Enterprise Edition Microsoft SQL Server 2005 Express Edition Microsoft SQL Server 2005 Workgroup Edition Еще…Меньше

Автор: Юваль Синай MVP

ОТКАЗ ОТ ОТВЕТСТВЕННОСТИ ЗА СОДЕРЖИМОЕ ОБЩЕДОСТУПНЫХ РЕШЕНИЙ
КОРПОРАЦИЯ МАЙКРОСОФТ И/ИЛИ ЕЕ ПОСТАВЩИКИ НЕ ДЕЛАЮТ НИКАКИХ ЗАЯВЛЕНИЙ ОТНОСИТЕЛЬНО ПРИГОДНОСТИ, НАДЕЖНОСТИ ИЛИ ТОЧНОСТИ СВЕДЕНИЙ И СООТВЕТСТВУЮЩИХ ИЗОБРАЖЕНИЙ, ПРИВЕДЕННЫХ В НАСТОЯЩЕМ ДОКУМЕНТЕ. ВСЕ ЭТИ СВЕДЕНИЯ И СООТВЕТСТВУЮЩИЕ ИЗОБРАЖЕНИЯ ПРЕДОСТАВЛЕНЫ «КАК ЕСТЬ» БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. КОРПОРАЦИЯ МАЙКРОСОФТ И/ИЛИ ЕЕ ПОСТАВЩИКИ НАСТОЯЩИМ ОТКАЗЫВАЮТСЯ ОТ КАКИХ-ЛИБО ГАРАНТИЙНЫХ ОБЯЗАТЕЛЬСТВ И УСЛОВИЙ В ОТНОШЕНИИ ЭТИХ СВЕДЕНИЙ И СООТВЕТСТВУЮЩИХ ИЗОБРАЖЕНИЙ, ВКЛЮЧАЯ ВСЕ ПОДРАЗУМЕВАЕМЫЕ ГАРАНТИИ И УСЛОВИЯ ТОВАРНОЙ ПРИГОДНОСТИ, ПРИМЕНИМОСТИ ДЛЯ КОНКРЕТНЫХ ЦЕЛЕЙ, КАЧЕСТВА ИСПОЛНЕНИЯ, ПРАВ СОБСТВЕННОСТИ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ ИНТЕЛЛЕКТУАЛЬНОЙ СОБСТВЕННОСТИ. В ЧАСТНОСТИ, ВЫ ПОДТВЕРЖДАЕТЕ СВО СОГЛАСИЕ С ТЕМ, ЧТО КОРПОРАЦИЯ МАЙКРОСОФТ И/ИЛИ ЕЕ ПОСТАВЩИКИ НИ ПРИ КАКИХ ОБСТОЯТЕЛЬСТВАХ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ЗА ПРЯМОЙ ИЛИ КОСВЕННЫЙ УЩЕРБ, ШТРАФНЫЕ САНКЦИИ, СЛУЧАЙНЫЕ, ФАКТИЧЕСКИЕ, КОСВЕННЫЕ ИЛИ ИНЫЕ УБЫТКИ, ВКЛЮЧАЯ, В ЧАСТНОСТИ, УБЫТКИ ОТ УТРАТЫ ЭКСПЛУАТАЦИОННЫХ КАЧЕСТВ, ОТ ПОТЕРИ ДАННЫХ ИЛИ ПРИБЫЛЕЙ В СВЯЗИ С ИСПОЛЬЗОВАНИЕМ ИЛИ НЕВОЗМОЖНОСТЬЮ ИСПОЛЬЗОВАТЬ ЭТИ СВЕДЕНИЯ И СООТВЕТСТВУЮЩИЕ ИЗОБРАЖЕНИЯ, СОДЕРЖАЩИЕСЯ В НАСТОЯЩЕМ ДОКУМЕНТЕ, ВОЗНИКШИЕ ВСЛЕДСТВИЕ СОГЛАШЕНИЯ, ГРАЖДАНСКОГО ПРАВОНАРУШЕНИЯ, ХАЛАТНОСТИ, ОБЪЕКТИВНОЙ ОТВЕТСТВЕННОСТИ ИЛИ ИНЫМ ОБРАЗОМ, ДАЖЕ ЕСЛИ КОРПОРАЦИЯ МАЙКРОСОФТ ИЛИ ЕЕ ПОСТАВЩИКИ ЗАРАНЕЕ БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКОГО УЩЕРБА.


Примечание. Для исправления ошибок подключения к SQL Server воспользуйтесь следующим средством устранения неполадок: Устранение ошибок подключения к SQL Server

Признаки

После установки Microsoft SQL Server 2014, SQL Server 2012, SQL Server 2008, SQL Server 2005 и SQL Server 2000 и попытки подключения к серверу, где запущена программа SQL Server, отображается одно из следующих сообщений об ошибке:

  • Ошибка входа в систему для пользователя ‘%.*ls’. Имя пользователя является именем пользователя SQL Server, и его нельзя использовать для проверки подлинности Windows.%.*ls

  • Ошибка входа в систему для пользователя ‘<имя_пользователя>‘. Пользователь не связан с доверенным соединением с SQL Server. (Microsoft SQL Server, ошибка: 18452)

  • Ошибка входа в систему для пользователя ‘<имя_пользователя>‘. (Microsoft SQL Server, ошибка: 18456)

Решение

Эта проблема возникает, если пользователь пытается войти в систему, используя учетные данные, которые нельзя проверить. Эта проблема может возникать при следующих условиях.

Чтобы решить эту проблему, настройте для SQL Server смешанный режим проверки подлинности. Для этого выполните следующие действия:

SQL Server 2014, SQL Server 2012, SQL Server 2008 и SQL Server 2005

  1. Откройте SQL Server Management Studio. Для этого выберите последовательно Пуск, Все программы, Microsoft SQL Server 20xx (где xx – это версия SQL), а потом SQL Server Management Studio.

  2. Щелкните сервер правой кнопкой мыши и выберите пункт Свойства.

  3. На странице Безопасность в разделе Проверка подлинности сервера нажмите кнопку параметра SQL Server и режим проверки подлинности Windows, а потом нажмите кнопку ОК.

  4. В диалоговом окне SQL Server Management Studio нажмите кнопку ОК, чтобы перезапустить SQL Server. 

    Дополнительные сведения см. в статье Выбор режима проверки подлинности в электронной документации на SQL Server.

SQL Server 2000

  1. Откройте программу Enterprise Manager. Для этого выберите последовательно Пуск, Все программы, Microsoft SQL Server 2000, а потом SQL Server Enterprise Manager.

  2. Разверните группу сервера.

  3. Щелкните сервер правой кнопкой мыши и выберите пункт Свойства.

  4. Откройте вкладку Безопасность.

  5. В разделе Проверка подлинности нажмите кнопку параметра SQL Server и Windows.

  6. Перезагрузите SQL Server, чтобы изменение вступило в силу.

Примечание. Когда SQL Server устанавливается с использованием режима проверки подлинности Windows, после чего режим меняется на режим «Проверка подлинности SQL Server и Windows», имя для входа sa сначала отключается. Это вызывает ошибку с состоянием 7: «Ошибка входа для пользователя ‘sa’.» Чтобы активировать имя пользователя sa, см. статью Инструкция: изменение режима проверки подлинности сервера.

Чтобы устранить эту проблему, убедитесь, что это имя пользователя SQL Server существует. Дополнительные сведения см. в статье Создание пользователя для входа в электронной документации на SQL Server.

То, что пользователь Windows является нераспознанным, означает, что Windows не может проверить данные для входа. Это может быть связано с тем, что вход в Windows происходит с недоверенного домена. Чтобы устранить эту проблему, убедитесь, что вы входите в систему с правильного домена.

Дополнительные сведения об ошибке

Если вы все равно не можете подключиться к SQL Server, проверьте состояние ошибки в журнале ошибок SQL Server, чтобы установить причину ошибки входа в систему.

Чтобы повысить уровень безопасности, в сообщении об ошибке, которое возвращается клиенту, намеренно скрываются подробности об ошибке проверки подлинности. Однако в журнале ошибок SQL Server соответствующая запись об ошибке содержит состояние ошибки, которое соответствует состоянию ошибки проверки подлинности. Сравните состояние ошибки со списком ниже, чтобы определить причину ошибки входа в систему:

Область

Описание

2

ИД пользователя недействительный.

5

ИД пользователя недействительный.

6

Попытка использовать имя пользователя Windows для проверки подлинности SQL Server.

7

Имя пользователя отключено, и пароль неправильный.

8

Указан неверный пароль.

9

Недействительный пароль.

11

Имя пользователя действительное, ошибка доступа к серверу.

12

Имя пользователя действительное, но произошла ошибка доступа к серверу.

18

Необходимо изменить пароль.

Нужна дополнительная помощь?

I use windows 7 ultimate. I can login with windows authentication mode but SQL authentication with user sa doesn’t work. sa user is enabled. So what do I do?

RBT's user avatar

RBT

23.1k21 gold badges155 silver badges232 bronze badges

asked Aug 27, 2010 at 11:16

Rev's user avatar

Go to Start > Programs > Microsoft SQL Server > Enterprise Manager

Right-click the SQL Server instance name > Select Properties from the context menu > Select Security node in left navigation bar

Under Authentication section, select SQL Server and Windows Authentication

Note: The server must be stopped and re-started before this will take effect

Error 18452 (not associated with a trusted sql server connection)

RBT's user avatar

RBT

23.1k21 gold badges155 silver badges232 bronze badges

answered Aug 27, 2010 at 11:18

Kashif's user avatar

KashifKashif

13.8k17 gold badges63 silver badges98 bronze badges

Login with windows authentication mode and fist of all make sure that the sa authentication is enabled in the server, I am using SQL Server Management Studio, so I will show you how to do this there.

Right click on the server and click on Properties.

enter image description here

Now go to the Security section and select the option SQL Server and Windows Authentication mode

enter image description here

Once that is done, click OK. And then enable the sa login.

Go to your server, click on Security and then Logins, right click on sa and then click on Properties.

enter image description here

Now go tot Status and then select Enabled under Login. Then, click OK.

Now we can restart the SQLExpress, or the SQL you are using. Go to Services and Select the SQL Server and then click on Restart. Now open the SQL Server Management Studio and you should be able to login as sa user.

answered Aug 29, 2019 at 9:58

Sibeesh Venu's user avatar

Sibeesh VenuSibeesh Venu

17k11 gold badges93 silver badges136 bronze badges

  1. Click on Start menu > Programs > Microsoft Sql Server > Configuration Tools

  2. Select Sql Server Surface Area Configuration.

  3. Now click on Surface Area configuration for services and connections

  4. On the left pane of pop up window click on Remote Connections and Select Local and Remote connections radio button.

  5. Select Using both TCP/IP and named pipes radio button.

  6. click on apply and ok.

Now when try to connect to sql server using sql username and password u’ll get the error mentioned below

Cannot connect to SQLEXPRESS.

ADDITIONAL INFORMATION:

Login failed for user ‘username’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
ation
To fix this error follow steps mentioned below

  1. connect to sql server using window authentication.

  2. Now right click on your server name at the top in left pane and select properties.

  3. Click on security and select sql server and windows authentication mode radio button.

  4. Click on OK.

  5. restart sql server servive by right clicking on server name and select restart.

Now your problem should be fixed and u’ll be able to connect using sql server username and password.

Have fun.
Ateev Gupta

answered Feb 2, 2011 at 12:03

Ateev Gupta's user avatar

  1. First make sure sa is enabled
  2. Change the authontication mode to mixed mode (Window and SQL authentication)
  3. Stop your SQL Server
  4. Restart your SQL Server

RBT's user avatar

RBT

23.1k21 gold badges155 silver badges232 bronze badges

answered Aug 24, 2013 at 10:23

user2713396's user avatar

  1. Go to services.msc from run prompt.
  2. Restart the services of SQL server(MSSQLSERVER)
  3. Restart the services of SQL server(SQLEXPRESS)

RBT's user avatar

RBT

23.1k21 gold badges155 silver badges232 bronze badges

answered Jul 18, 2016 at 10:55

siva's user avatar

sivasiva

1151 silver badge4 bronze badges

I faced the very same error when I was trying to connect to my SQL Server 2014 instance using sa user using SQL Server Management Studio (SSMS). I was facing this error even when security settings for sa user was all good and SQL authentication mode was enabled on the SQL Server instance.

Finally, the issue turned out to be that Named Pipes protocol was disabled. Here is how you can enable it:

Open SQL Server Configuration Manager application from start menu. Now, enable Named Pipes protocol for both Client Protocols and Protocols for <SQL Server Instance Name> nodes as shown in the snapshot below:

enter image description here

Note: Make sure you restart the SQL Server instance after making changes.

P.S. I’m not very sure but there is a possibility that the Named Pipes enabling was required under only one of the two nodes that I’ve advised. So you can try it one after the other to reach to a more precise solution.

answered Mar 15, 2018 at 12:43

RBT's user avatar

RBTRBT

23.1k21 gold badges155 silver badges232 bronze badges

I was stuck in same problem for many hours. I tried everything found on internet.

At last, I figured out a surprising solution : I had missed SQLEXPRESS part of the Server name: MY-COMPUTER-NAMESQLEXPRESS

I hope this helps someone who is stuck in similar kind of problem.

answered Jun 29, 2020 at 7:39

Bigyan Chapagain's user avatar

In my case I just closed MSSMS and restarted SQL SERVER from services.

answered Jul 4, 2022 at 11:54

Ali Sheikhpour's user avatar

Ali SheikhpourAli Sheikhpour

9,7655 gold badges38 silver badges80 bronze badges

Recently a user has reported error 18452 while connecting to database server. Full description of this error is given below:

Error: 18452, Severity: 14, State: 1.
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

You can see the screenshot of the error 18452 in below image.

error 18452

Error 18452 – Root Cause

Reason behind error 18452 is because of wrong security authentication mode configuration. SQL Server is set to accept only windows logins to connect to database instance.

As we know SQL Server uses two authentication modes to accept database connections. One is Windows Authentication mode and another one is SQL Server and Windows Authentication mode. We also call it Mixed Authentication mode.

Sometimes, SQL Server authentication mode is set to SQL Server and Windows Authentication mode to accept SQL as well as windows connections but still you will face this issue. That might be because you try to connect to a server that has Always on Availability Group configuration or database mirroring configuration.

Suppose you have AOAG configuration and you are connecting to database using primary replica name not listener name using a login for which default database is set as availability database. If failover got happen during your activity or you are connecting to secondary replica using a login for which default database is set as availability database then also you will get this error 18452 along with some SSPI context error that I have given below.

Error: 17806, Severity: 20, State: 14.
SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. The logon attempt failed 

SSPI handshake errors comes because of Kerberos failure, which would most likely be related to non-existent SPN or bad SPN for SQL Server.

Solution

To fix this issue first we need to check the authentication mode set for your SQL Server Instance. If your SQL Server instance is running with windows authentication mode then you must change it to Mixed mode so that windows and SQL both type of logins can be authenticated.

To check the configured authentication mode for your SQL Server Instance, we need to launch SQL Server Instance property window. Right click at the instance node and click at the properties option as shown in below screenshot.

Launch SQL Server Instance Property Window

Once you will click at Properties option, you will be getting below SQL Server instance property window. Click at Security option from left side pane. You can see current Server Authentication configuration is set to Windows Authentication mode in below screenshot.

SQL Server Instance Property Window

Now we will change it to SQL Server and Windows Authentication mode. Select the radio button for SQL Server and Windows Authentication mode option and click ok button to proceed. You can see that I have selected above mode to apply the changes.

SQL Server Instance Property Window

Restart SQL Server services to apply the changes.

If your SQL Server Instance is already set with SQL Server and Windows Authentication mode then you should fix this issue in separate way. As I described above that one of the probable reason to get this error 18452 is because you might use AOAG replica server name to connect to the database with the login for which default database is set as the AOAG availability database.

If failover will happen then you would not be able to access the database because it will become secondary. Error 18452 will be generated along with SSPI handshake errors because same database is set as default database for your login that has become inaccessible now because of acting secondary database in AOAG. Failover will not happen for you because you are using replica server name to make database connection.

Possible solution to fix this issue is failback the AOAG to your earlier primary replica or you should use AOAG Listener name to make database connection. Also, to avoid this error during failover you should set default database for your login to master rather than availability database.

I hope you like this article. Please follow our Facebook page and Twitter handle to get latest updates.

Read More:

  • Fix Error 18456: Login failed for user “User_Name”
  • Fix Error 4064: Cannot open user default database. Login failed
  • Error 53: Could not open a connection on SQL Server
  • AOAG Listener Error 19471: The handle is Invalid
  • Author
  • Recent Posts

Manvendra Deo Singh

I am working as a Technical Architect in one of the top IT consulting firm. I have expertise on all versions of SQL Server since SQL Server 2000. I have lead multiple SQL Server projects like consolidation, upgrades, migrations, HA & DR. I love to share my knowledge. You can contact me on my social accounts for any consulting work.

Manvendra Deo Singh

Summary

Article Name

Fix Error 18452: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Description

Recently we got a login issue where one of the SQL user was not able to connect to database instance and was getting error 18452. Full error description of this error is given below: Error: 18452, Severity: 14, State: 1.
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Понравилась статья? Поделить с друзьями:
  • Ошибка 1920 как исправить
  • Ошибка 184 установка radeon software не может быть продолжена виндовс 10 как исправить
  • Ошибка 1920 microsoft office 2010
  • Ошибка 184 программа установки amd не может продолжать работу
  • Ошибка 184 при установке драйвера amd radeon на windows 10