Error number 18456 sql server

Вы можете столкнуться с ошибкой SQL Server 18456, если сервер не может аутентифицировать соединение, и это может быть вызвано недоступностью прав

Вы можете столкнуться с ошибкой SQL Server 18456, если сервер не может аутентифицировать соединение, и это может быть вызвано недоступностью прав администратора для SQL-сервера или если протокол TCP / IP отключен в настройках SQL-сервера.

Проблема возникает, когда пользователь пытается подключиться к серверу SQL (локальному или удаленному), но обнаруживает ошибку 18456 (с разными состояниями).

Ошибка Microsoft SQL Server 18456

Вы можете исправить ошибку SQL-сервера 18456, попробовав приведенные ниже решения, но перед этим проверьте, решает ли проблему перезагрузка сервера, клиентского компьютера и сетевых компьютеров. Кроме того, убедитесь, что вы вводите правильное имя пользователя и пароль (а не копируете адрес).

Также проверьте, правильно ли вы вводите имя базы данных (без опечаток), и убедитесь, что вы соответствующим образом обновили файл конфигурации. Кроме того, проверьте, решает ли проблему разблокировка учетной записи (с помощью запроса ALTER LOGIN WITH PASSWORD = UNLOCK). Если вы видите ошибки в журнале ошибок SQL, убедитесь, что ваш SQL-сервер не атакован. И последнее, но не менее важное: убедитесь, что часы сервера и клиентского компьютера установлены правильно.

Вы можете столкнуться с ошибкой 18456, если SQL-сервер не имеет повышенных разрешений на выполнение своей операции, и запуск его от имени администратора (или отключение элементов управления UAC на сервере) может решить проблему.

Откройте SQL Server от имени администратора

  1. Щелкните Windows и введите SQL Server Management Studio.
  2. Теперь щелкните правой кнопкой мыши SMSS и выберите «Запуск от имени администратора».Запустите Microsoft SQL Server Management Studio от имени администратора.
  3. Затем нажмите Да (если получено приглашение UAC) и проверьте, не содержит ли SQL-сервер ошибки 18456.
  4. Если нет, проверьте, решает ли проблему отключение UAC на сервере.

Запуск SQL Server в однопользовательском режиме

  1. Щелкните Windows, введите и откройте диспетчер конфигурации SQL Server.
  2. Теперь щелкните правой кнопкой мыши службу SQL Server (на вкладке «Службы SQL Server») и выберите «Свойства».Откройте свойства SQL Server
  3. Затем перейдите на вкладку Параметры запуска и в поле Укажите параметр запуска введите: -m
  4. Теперь нажмите «Добавить» и примените изменения.Добавьте параметр «-m» к параметрам запуска SQL Server.
  5. Затем щелкните правой кнопкой мыши службу SQL Server и выберите «Перезагрузить».Перезапустите службу SQL Server.
  6. Теперь щелкните Windows, введите: SQL Server Management Studio, щелкните правой кнопкой мыши SMSS и выберите Запуск от имени администратора.
  7. Теперь проверьте, можете ли вы подключиться к SQL Server от имени администратора.
  8. Если это так, добавьте учетную запись домена на SQL-сервер и назначьте ей роль SysAdmin.
  9. Теперь вернитесь в окно диспетчера конфигурации SQL Server и удалите параметр -m на вкладке Параметры запуска.
  10. Затем перезапустите службу SQL Server (шаг 3) и проверьте, нормально ли работает SQL-сервер.

Если проблема не исчезнет, ​​проверьте, правильно ли настроены параметры запуска или сведения о пути. Если проблема все еще существует, убедитесь, что ваша учетная запись пользователя имеет необходимые разрешения для служб базы данных / отчетов, а затем проверьте, решена ли проблема.

Включите протокол TCP / IP в диспетчере конфигурации сервера.

Код ошибки 18456 на сервере SQL означает, что серверу не удалось аутентифицировать соединение, и это может произойти, если протокол TCP / IP, необходимый для доступа к базе данных в сети, отключен в диспетчере конфигурации сервера. В этом контексте включение TCP / IP в диспетчере конфигурации SQL Server может решить проблему.

  1. Щелкните Windows и разверните Microsoft SQL Server, указав год, например, 2008 (вам может потребоваться немного прокрутить, чтобы найти параметр).
  2. Теперь откройте диспетчер конфигурации SQL Server и нажмите Да (если получено приглашение UAC).
  3. Затем разверните сетевую конфигурацию SQL Server и выберите Протоколы для (имя сервера / базы данных) на левой панели.
  4. Теперь на правой панели дважды щелкните TCP / IP и выберите Да в раскрывающемся списке Включено.Откройте TCP / IP в протоколах конфигурации сети SQL Server
  5. Затем примените изменения и щелкните Windows.Включить TCP / IP в SQL
  6. Теперь введите «Службы», щелкните правой кнопкой мыши результат «Службы» и выберите «Запуск от имени администратора».Откройте службы в качестве администратора
  7. Затем щелкните правой кнопкой мыши SQL Server (с именем сервера) и выберите «Перезагрузить».Перезапустите службу SQL в окне служб.
  8. Теперь проверьте, очищен ли SQL-сервер от ошибки 18456.

Если это не помогло, убедитесь, что вы подключаетесь к правильному порту SQL-сервера (особенно, если вы используете сервер в многосерверной среде).

Измените режим аутентификации SQL Server

Сервер SQL может отображать ошибку 18456, если метод аутентификации сервера SQL не настроен должным образом (например: вы пытаетесь войти в систему с использованием аутентификации сервера SQL, тогда как сервер настроен на использование аутентификации Windows). В этом случае изменение метода аутентификации SQL-сервера может решить проблему. Прежде чем двигаться дальше, убедитесь, что для текущего пользователя включен статус входа в систему (например, SA).

  1. В обозревателе объектов Microsoft SQL Server Management Studio щелкните правой кнопкой мыши свой сервер и выберите «Свойства».
  2. Теперь на левой панели выберите Безопасность, а на правой панели выберите SQL Server и проверку подлинности Windows (или наоборот).Включить SQL Server и проверку подлинности Windows
  3. Затем примените изменения и в обозревателе объектов щелкните правой кнопкой мыши сервер.
  4. Теперь выберите «Перезагрузить» и после перезапуска проверьте, можете ли вы подключиться к базе данных без ошибки 18456.

Если вы не можете войти в SQL, вы можете установить MS Power Tools и выполнить следующую команду с повышенными привилегиями:

psexec.exe -i -s ssms.exe

После этого вы можете использовать учетную запись установки SQL, чтобы внести изменения, а также убедиться, что учетная запись SA не отключена:

Включите учетную запись SA и сбросьте пароль учетной записи

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

  1. Запустите Microsoft SQL Server Management Studio (возможно, вам придется использовать учетную запись администратора домена) и разверните Безопасность.
  2. Затем дважды щелкните Logins и откройте SA.Откройте учетную запись SA в Microsoft SQL Server Management Studio.
  3. Теперь введите новый пароль и подтвердите его (убедитесь, что вы используете надежный пароль).
  4. Затем перейдите на вкладку Server Roles и убедитесь, что выбраны следующие роли: Public SysadminВключение ролей общедоступного сервера и сервера системного администратора для учетной записи SA
  5. Теперь перейдите на вкладку «Статус» и на правой панели выберите «Включено» (в разделе «Вход»).Включение учетной записи SA в SQL
  6. Затем примените изменения и нажмите кнопку Windows.
  7. Теперь введите Services и щелкните его правой кнопкой мыши.
  8. Затем выберите «Запуск от имени администратора» и перейдите к службе SQL Server.
  9. Теперь щелкните его правой кнопкой мыши и выберите «Перезагрузить».
  10. После перезапуска службы проверьте, устранена ли ошибка 18456 SQL-сервера.

Создайте новый логин и перезапустите службы Reporting Services

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

  1. Запустите Microsoft SQL Server Management Studio и разверните вкладку «Безопасность».
  2. Затем разверните Логины и щелкните его правой кнопкой мыши.
  3. Теперь выберите «Новый вход» и введите учетные данные (в имени входа выберите учетную запись компьютера), если используется проверка подлинности SQL Server.Создать новый логин в SQL Server
  4. Затем не забудьте снять флажок «Пользователь должен сменить пароль при следующем входе в систему» ​​и выберите базу данных.
  5. Теперь перейдите на вкладку Server Roles и выберите роль Public.
  6. Затем на вкладке «Сопоставление пользователей» обязательно выберите базу данных и выберите db_owner.Выберите db_owner для базы данных в SQL
  7. Теперь примените ваши изменения и щелкните Windows.
  8. Затем введите Services и щелкните правой кнопкой мыши результат Services. Затем выберите Запуск от имени администратора.
  9. Теперь щелкните правой кнопкой мыши службу отчетов SQL Server и выберите «Перезагрузить».Перезапустите службу отчетов SQL Server.
  10. Затем повторно подключитесь к базе данных и проверьте, очищен ли сервер SQL от ошибки 18456.

Если это так, убедитесь, что вы создали пользователя в BUILTIN administrators, и затем вы можете использовать этого пользователя для управления SQL Server. Если вы восстановили базу данных из резервной копии, будет лучше удалить и повторно добавить пользователей, чтобы удалить все старые записи пользователей. Если вы хотите запустить SQL-сервер от имени другого пользователя, введите Microsoft SQL Server в поиске Windows, Shift + щелкните правой кнопкой мыши на SQL Server и выберите «Запуск от имени другого пользователя». И последнее, но не менее важное: проверьте, решает ли проблема использование Azure Data Studio с сервером SQL.

Input : select * from sys.sysmessages where error = 18456

Output: Login failed for user ‘%.*ls’.%.*ls%.*ls

This is one of the infamous error message (and number) that most of the DBAs and developers have come across while working on SQL server. This message simply denotes that the client call was able to reach the SQL server and then an ACCESS was denied to the particular login for a reason. To figure out the exact reason, this error number 18456 with its STATE number is logged into the SQL server error log file, if SQL server was allowed or configured to capture the failed logins.

Configuring SQL server for capturing login failures:

By default, SQL server is configured to capture only failed logins but it can be changed to any of the options as mentioned in this books online link http://technet.microsoft.com/en-us/library/ms188470.aspx

Below figure shows these options to have login failed messages written into error log

error_18456_1

Accessing Error log:

Now that, we know SQL server logs all login failed messages into its error log and windows event viewer but how do I access them?

Windows event viewer:

GO to start –> Run –> Eventvwr –> open up the application logs, and now we could see the login failed error message with computer name, instance name, date and time and finally the reason for the login failed

error_18456_2

SQL Error log:

SQL server error log can be viewed from multiple places

  • If we have gained access or can gain access to SQL server with different logon credentials then always use sp_readerrorlog, xp_readerrorlog or use the GUI option of opening up Management node –> SQL server Logs –> View –> SQL server log. Same sample shown above looks like

error_18456_3

  • In a case where we cannot gain access to SQL server, then we may use the actual error log path and open the txt file physically from the file system. Use SQL server configuration manager to find the error log path and from there you could open the file. Get the value next to –e parameter and that gives the actual error log file location

error_18456_5

Typically the error log files are available in install directory for SQL server.

SQL server 2005:

C:MSSQLMSSQL.1MSSQLLOGErrorlog

SQL server 2008:

C:MSSQLMSSQL10.instanceIDMSSQLLogErrorlog

InstanceID – MSSQLSERVER for default instance and for named instance it’s the name of the instance

STATES of 18456

State 1:

This is a very generic error message that is sent to the client tools to deliberately hide the nature of the login failure issue. However, the SQL Server error log, a corresponding error contains an error state that maps to an authentication failure condition with its state number.

error_18456_6

State 2 and 5:

This state occurs when a SQL server login logs in with the name that doesn’t exist in sql server. This error mostly comes in when users specify wrong user name or misspell the login name. I am logging in to my instance with a login name called DOESNTEXIST that really doesn’t exist and let’s see what the error state in error log is.

error_18456_7

Error: 18456, Severity: 14, State: 5.

Login failed for user ‘DOESNT EXIST’. Reason: Could not find a login matching the name provided. [CLIENT: ]

State 6:

This state occurs when a user tries to login with a WINDOWS account but specifying that as a sql server account. I have a windows account test (domaintest) but I am specifying it as a sql account and trying to login into SQL server, let’s see what state the error log has

error_18456_8

Error: 18456, Severity: 14, State: 6.

Login failed for user ‘domaintest’. Reason: Attppting to use an NT account name with SQL Server Authentication. [CLIENT: ]

State 7:

This state occurs when a wrong password is specified for a login which is disabled too. In this case, my SQL server user ‘Leks’ is disabled and I’m mentioning a wrong password for the connection

error_18456_9

Error: 18456, Severity: 14, State: 7.

Login failed for user ‘Leks’. Reason: An error occurred while evaluating the password. [CLIENT: ]

For the accounts (logins) that are disabled and if you specify the correct password, the error log is logged with 18470

Error: 18470, Severity: 14, State: 1.

Login failed for user ‘Leks’. Reason: The account is disabled. [CLIENT:]

State 8:

This state occurs when password is not correct in the connection string for any SQL server authenticated logins. I’m logging into SQL server using ‘sa’ account with wrong password

error_18456_10

Error: 18456, Severity: 14, State: 8.

Login failed for user ‘sa’. Reason: Password did not match that for the login provided. [CLIENT:]

State 9:

This state means that the password was rejected by the password policy check as an invalid one. The policy API has rejected the password with error NERR_BadPassword. See more info on this error and visit http://msdn.microsoft.com/library/default.asp?url=/library/enus/netmgmt/netmgmt/net_validate_output_arg.asp

State 10:

This is one of the rare state and is very well documented here – http://support.microsoft.com/kb/925744

State 11 & 12:

This state means the login was valid but server access failed. One such example is when a windows login in trying to access sql server that wasn’t explicitly added to sql server (at least starting from 2008). To overcome this error, you can add that domainwindows account to sql logins explicitly.

Other reasons for this to happen are when a login is denied access (revoking connect permissions to SQL) to SQL server and UAC issues.SQL server product team covered this state extensively here –http://blogs.msdn.com/b/sqlserverfaq/archive/2010/10/27/troubleshooting-specific-login-failed-error-messages.aspx

Windows account which do not have access

Error: 18456, Severity: 14, State: 11.

Login failed for user ‘domainuser’. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT:]

SQL account that was denied access

Error: 18456, Severity: 14, State: 12.

Login failed for user ‘Leks’. Reason: Login-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT:]

State 13:

This state occurs when any login tries to access to sql server with services paused on it. But for this reason, there will also be other error number 17142 logged along with 18456.

error_18456_11

Error: 17142, Severity: 14, State: 0.

SQL Server service has been paused. No new connections will be allowed. To resume the service, use SQL Computer Manager or the Services application in Control Panel.

Error: 18456, Severity: 14, State: 13.

Login failed for user ”. Reason: SQL Server service is paused. No new connections can be accepted at this time. [CLIENT:]

State 16:

This state occurs for logins that do not have access to the target database or the database doesn’t exist anymore with the same name or offline. We always specify the database in the connection string as initial catalog or using -d parameter.

This can be fixed by granting access to the database and sometimes orphan users existing in the database. Orphan users can be fixed by sp_change_users_login

error_18456_12

This state occurs in SQL server 2005 and same is changed to 40 in SQL server 2008 and above

Error: 18456, Severity: 14, State: 16.

Login failed for user ‘Leks’. [CLIENT: <local machine>]

State 18:

This state occurs when a sql login is added with USER MUST CHANGE THEIR PASSORD ON FIRST LOGON or a login that needs to have its password changed as per the domain or windows password policy ; this state gets in to error log when the new password box prompts up.

error_18456_14

This error is logged with state 18488

Error: 18488, Severity: 14, State: 1.

Login failed for user ‘Tester’. Reason: The password of the account must be changed. [CLIENT: ]

State 23:

This state can happen due to couple reasons; first being simultaneous action of shutting down SQL SERVER and any incoming logins to sql server takes place. The other one is documented here as an issue http://support.microsoft.com/kb/937745

State 38:

This is similar to state 16 but this was introduced from SQL server 2008 and above.

Database doesn’t exist or login doesn’t have access to the database.

Error: 18456, Severity: 14, State: 38.

Login failed for user ‘Leks’. Reason: Failed to open the explicitly specified database. [CLIENT: ]

State 40:

This state occurs when the login’s default database doesn’t exist in SQL server or offline or the login doesn’t have access to the default database. This state is always logged alongside with error 4064

Error: 18456, Severity: 14, State: 40.

Login failed for user ‘Leks’. Reason: Failed to open the database specified in the login properties. [CLIENT: ]

State 58:

This state occurs when a SQL server login is used for accessing SQL server when SQL server is installed with windows authentication mode.

You may have to use only windows login or change the authentication to mixed authentication for this to work – http://msdn.microsoft.com/en-us/library/ms188670.aspx. The authentication mode change always requires a SQL restart to come into effect.

Error: 18456, Severity: 14, State: 58.

Login failed for user ‘sa’. Reason: An attppt to login using SQL authentication failed. Server is configured for Windows authentication only. [CLIENT: <local machine>]

I have tried and covered most of the states that I know of, and if you find states that I haven’t discussed happy to hear and add to this list. Apart from the error 18456, there are other login failure errors that you might have to keep an eye on

18451

Login failed for user ‘%.*ls‘. Only administrators may connect at this time.%.*ls

18452

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.%.*ls

18458

Login failed. The number of simultaneous users already equals the %d registered licenses for this server. To increase the maximum number of simultaneous users, obtain additional licenses and then register them through the Licensing item in Control Panel.%

18459

Login failed. The workstation licensing limit for SQL Server access has already been reached.%.*ls

18460

Login failed. The number of simultaneous users has already reached the limit of %d licenses for this ‘%ls’ server. Additional licenses should be obtained and installed or you should upgrade to a full version.%.*ls

18461

Login failed for user ‘%.*ls‘. Reason: Server is in single user mode. Only one administrator can connect at this time.%.*ls

18462

The login failed for user “%.*ls“. The password change failed. The password for the user is too recent to change. %.*ls

18463

The login failed for user “%.*ls“. The password change failed. The password cannot be used at this time. %.*ls

18464

Login failed for user ‘%.*ls‘. Reason: Password change failed. The password does not meet Windows policy requirements because it is too short.%.*ls

18465

Login failed for user ‘%.*ls‘. Reason: Password change failed. The password does not meet Windows policy requirements because it is too long.%.*ls

18466

Login failed for user ‘%.*ls‘. Reason: Password change failed. The password does not meet Windows policy requirements because it is not complex enough.%.*ls

18467

The login failed for user “%.*ls“. The password change failed. The password does not meet the requirements of the password filter DLL. %.*ls

18468

The login failed for user “%.*ls“. The password change failed. An unexpected error occurred during password validation. %.*ls

18470

Login failed for user ‘%.*ls‘. Reason: The account is disabled.%.*ls

18471

The login failed for user “%.*ls“. The password change failed. The user does not have permission to change the password. %.*ls

18482

Could not connect to server ‘%.*ls’ because ‘%.*ls’ is not defined as a remote server. Verify that you have specified the correct server name. %.*ls.

18483

Could not connect to server ‘%.*ls’ because ‘%.*ls’ is not defined as a remote login at the server. Verify that you have specified the correct login name. %.*ls.

18485

Could not connect to server ‘%.*ls’ because it is not configured to accept remote logins. Use the remote access configuration option to allow remote logins.%.*ls

18486

Login failed for user ‘%.*ls’ because the account is currently locked out. The system administrator can unlock it. %.*ls

18487

Login failed for user ‘%.*ls‘.Reason: The password of the account has expired.%.*ls

18488

Login failed for user ‘%.*ls‘.Reason: The password of the account must be changed.%.*ls

18489

The dedicated administrator connection is in use by “%.*ls” on “%.*ls“.%.*ls

Happy “login failure “troubleshooting

Sql server error 18456 is common issue appear during login process on Microsoft SQL Server. This error can happen when you try to login with local administrator, as well as under the domain administrator and under the sa. Microsoft SQL Server login failed error can be encountered due to varied reasons. Most of the time, an error code comes up with a description that gives a hint about what has gone wrong. But I some cases the error come without any description. In this article, we’ll take a look at the typical reasons of the error 18456 appear on SQL Server during login process and show different ways to solve this error.

The view of error:

“Login failed for user ‘<user_name>’. (Microsoft SQL Server, Error: 18456)”.

"<yoastmark

How To FIX SQL Server Error 18456

Troubleshoot with Short Solutions

Here, you have some possible reasons:

  1. The login does not exist or was not typed correctly
  2. Make sure that the username or password are correct
  3. The password is incorrect
  4. The user forgot the password or login
  5. The Windows Authentication is not in Mixed mode
  6. A virus resets all the passwords
  7. A malicious hacker reset the password
  8. The logins were damaged or the master database is damaged
  9. The database was migrated, but the logins were not migrated
  10. The administrator modified the passwords by mistake
  11. Restart the SLQ Server service

Troubleshoot with State of the Microsoft SQL error 18456

Most of the time the SQL error 18456 come with the severity and state number. A state number might not mean much, yet it can offer more details as to what is wrong and where to look next.

To get a more detailed info about Microsoft SQL Server Error 18456 reason, you need to open the SQL Server error log file – ERROR.LOG. This is plain text file located under folder MSSQLLog. Below are some states of the error 18456 sql server. The descriptions and potential solutions offer a quick explanation and potential troubleshooting guide.

 State Error Description
1 Error information is not available. This state usually means you do not have permission to receive the error details
2 Invalid user ID
5 User ID is not valid.
6 Attempt to use a Windows login name with SQL Authentication
7 Login disabled
8 Password is incorrect
9 Password is not valid
11-12 Valid login but server access failure
13 SQL Server service paused
16 Authorization is correct, but access to the selected database is not allowed
18 Change password required
27 Initial database not found
38 Could not find database requested by user
 

102 – 111

AAD failure.
122 – 124 Failure due to empty user name or password.
126 Database requested by user does not exist.
132 – 133 AAD failure.

Common Solution for Error 18456

If the issue cannot be resolved from with short solutions above, read below for additional information:

Read also other SQL Server Helping Posts:

  1. SQL Server Error 233
  2. Fix SQL server error 26 and error 40
  3. Restore Master Database

Checking the Server Authentication Mode

In this case you are trying to login on SQL Server using sql user. Once we login to SSMS using Windows Authentication, we need to check the security settings to confirm whether MSSQL is set up to allow both Windows and SQL Authentication.

Check and Change SQL Server Authentication Mode from GUI:

  1. In SSMS, right-click the Server Name at the top of the Object Explorer window and choose Properties.
  2. Next, click the Security page.
  3. If you find Windows Authentication is the only mode configured, this is the likely cause of sql server error 18456, Login failed for user ‘’.
  4. Setting the Server authentication mode to allow SQL Server and Windows Authentication, you will be able to login to MS-SQL with a SQL user and password or a Windows user and password. After making this change, you will need to restart the SQL Server service.

Server Authentication Mode

Server Authentication Mode

Change SQL Server Authentication Mode from regedit

You can use the registry to modify the authentication mode. Use the regedit to change the registry:

Image (regedit)

  1. machineHKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL ServerMSSQLXX.MSSQLSERVERMSSQLServer
  2. Change the login mode value.
    1. 2 is mixed mode.
    2. 1 is Windows Authentication.

Change SQL Server Authentication Mode from regedit

Change SQL Server Authentication Mode from regedit

Checking pass expired or login disabled

Check out that the password is not expired.

  1. Open SSMS, Instance – Security – Logins and find the user that have issue
  2. On general tab check if the Enforce password expiration and enforce password policy are checked
  3. Un-check them

Check out that the login is enabled.

  1. Open SSMS, Instance – Security – Logins and find the user that have issue
  2. On status tab and check if is selected the “Enabled” option

Reset the Password of the user

If you forget your password, you can ask your DBA to reset your account. The easiest way to reset the password is by using SQL Server Management Studio (SSMS).

  1. Go to security and Logins:
  2. Select the login and you can change the password:

Checking pass expired or login disabled

Checking pass expired or login disabled

  1. If you do not like to use SSMS, you can use T-SQL to create users and change the password:

USE [master] GOALTER LOGIN [Test] WITH ‘newpasswordtest’GOChange Windows Authentication

So we hope that you fixed the issue with the sql server error 18456.


Aftab Alam

Read time 6 minutes

We have been using SQL Server to manage our databases for a long time and update it with the latest version as soon it gets updates. But one of our team members started getting the error that login failed for the user. We always use SQL Server authentication and provide valid credentials. But the user is not able to connect with the server.

The above issue can happen to any SQL Server user and make it impossible to access your server and the saved databases. Generally, the user name is accepted but the password is considered false. And the error message displayed does not define the reason. However, administrators can check the error details in the event log to get a clear picture of the problem.

More About Server Error Code 18456

Microsoft SQL Server error code 18456 denotes a failed login attempt which may be due to an incorrect password entry. Generally, it happens even if the username is accepted. And the error message displayed does not define the reason. However, administrators can check the error details in the event log to get a clear picture of the problem.

Microsoft SQL Server error code 18456

This error may be interpreted as a mechanism to prevent unauthorized persons from accessing the server by guessing the credentials. But genuine users may find it hard to overcome the problem.

Probable causes and of SQL server login error code 18456

  • The username may be misspelled
  • The user account may not exist in the SQL Server.
  • The authentication mode would be different. Perhaps you are using SQ Server Authentication but Windows Authentication set for the user.
  • The username and password may have changed and the user should contact the administrator for the new credentials.
  • If the error is not showing any description but shows that the administrator has not authorized you to get the details of the error. Contact the administrator and get help with the issue.
  • The password of your SQL account is incorrect and the administrator may assign you the new credentials.
  • If the above solutions do not work for you, then you should run some basic troubleshooting methods.

How to protect your password during SQL Server authentication?

Unlike Windows Authentication, the SQL Server authentication method does not use user account credentials but creates its credentials in the SQL Server. The user must provide the username and password each time they try to access the SQL Server Management Studio using SQL Server authentication. There are some tips related to managing passwords for it.

  • It would help if you changed the password routinely to protect it from unauthorized access. SQL Server has a policy where “the user must change password at next login” each time they open the application.
  • A password expiration policy sets the number of days for the password’s validity. After that, you must change it.
  • The DBA can choose the Windows password policies that put the parameters for password length and inclusion of complexity level.

Resolution to SQL error code 18456

When an SQL Server is started for the first time, there is a possibility that ‘Windows authentication’ is enabled under the security option. In such a situation, the server will not recognize the user and the user will get the failed login 18456 error. If you want to login through ‘SQL Server Authentication’, then enable it by following the steps:

  1. Go to the Properties of the selected server (from the right-click menu).
    SQL Server Authentication
  2. Now go to the Security page and under Server authentication choose the option SQL Server and Window Authentication mode.
    SQL Server and Window Authentication mode
  3. Now expand Security > Logins and right-click the server name, and select Properties.
  4. In the Login properties dialogue box, provide the password details (under SQL Authentication).
  5. Now go to the Status tab, and choose Enabled under Login.
  6. Click OK and restart the SQL server.

But if you want to use the ‘Windows authentication’ option, then it will be better if an administrator provides admin rights to the user, so that he must be able to log in without any hassle.

  1. At first, login to SQL Server as an administrator, and go to the server where the particular user account is residing. Expand the Logins, right-click on the desired account and click New Login.
    login to SQL Server as an administrator
  2. In the Login – New window, click Search.
    window, click Search
  3. Now type the username of the account which you have selected in the Logins folder and then click Check Names. Click OK.
    Click OK
  4. Now back in the Login – New window, go to the Server Roles tab and check the sysadmin option.
    sysadmin option
  5. Now go to the Securables tab and verify the role addition.

All the above-mentioned methods are used to overcome login problems. However, they cannot help when the SQL database is corrupt or MDF files are inaccessible. To recover SQL data and to repair the MDF files in such cases, you need an efficient MDF recovery tool like Kernel for SQL server recovery. It scans, analyzes, and repair MDF or NDF file and brings back all the precious data within no time.

Conclusion

Microsoft SQL Server error code 18456 for failed login attempt by a user is annoying to authenticated users and therefore its probable reasons are discussed along with two login enabling methods via Windows Authentication or SQL Server Authentication are explained to users to overcome the situations. For users encountering other SQL Server errors due to corrupted database files, a popular and reliable SQL Database Recovery tool is suggested as well.

More Information

  • How to Repair MDF File?
  • Getting unmapped SQL error code 10038 when connecting to MS SQL
  • How to Resolve SQL Server Error 2515?
  • Data Corruption in SQL Server and MDF Recovery
  • Corruption due to table partition error in SQL Server 2005

Понравилась статья? Поделить с друзьями:
  • Error number 145
  • Error number 144
  • Error number 138 occurred
  • Error number 1205 lock wait timeout exceeded try restarting transaction
  • Error number 1146 на сайте