Monday, September 1, 2014

Can’t Login to SQL Server with Windows Authentication

Can't login to SQL Server with Windows Authentication? Have you accidentally removed the built-in administrator account from SQL Server logins? Does the Windows account become locked and unusable for further use? Don't worry! In this article we'll show you how to enable mixed mode authentication in case your SQL Server is configured for Windows Authentication only, and then enable / reset your SA password easily!

Part 1: Enable Mixed Mode Authentication

If you can connect to SQL Server with SQL Server Management Studio, you can easily switch to mixed mode with just a few mouse clicks! However, what to do if you're locked out of every SQL Server account and can't login even with Windows Authentication? Here is a simple registry trick:
  1. Press the Windows key + R to bring up the Run box. Type regedit and press Enter.
  2. Navigate to the registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer, where MSSQL10.SQLEXPRESS is the name of your SQL Server instance.
  3. In the right panel, change the LoginMode from 1 to 2. (1 = Windows authentication Only. 2 = Mixed mode.) sql-server-login-methods
  4. Restart your SQL Server instance for this change to take effect.
Part 2: Enable / Unlock SA Account

Even if the authentication mode is switched to SQL Server mixed mode after the installation, the SA account is still disabled and must be manually enabled. With SQL Server Password Changer you can offline enable / unlock your SA account in case your SA account is disabled, locked out or you simply forgot the password. Here are steps:
  1. First of all, you need to stop your SQL Server service so the password recovery software can access the master.mdf database offline.
  2. Download the SQL Server Password Changer on your computer. After you've downloaded it, double-click the setup file to install it.
  3. Start SQL Server Password Changer. Click on Open File button and select the master.mdf database for your SQL Server instance. In my example, the master.mdf file is located in C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA. select-master-database
  4. The program will extract all the SQL Server logins from the master.mdf database. Choose the SA account and click on Change Password button. Set a new password in the popup window and click OK. reset-sa-password
  5. Now you've successfully enabled / unlocked the SA account. Start your SQL Server service and you can now login to the SA account with your new password! It's that easy!

Wednesday, May 7, 2014

How to Recover SA Password in Single-user Mode

Forgot your SA password and can't connect to SQL Server? How to login to SA account after locked out of SQL Server? Start SQL Server in single-user mode and you can reset SQL Server password easily. This hacking trick makes it possible to unlock SQL Server login without resetting the password of any existing account.

How to Recover SA Password in Single-user Mode
  1. Launch SQL Server Configuration Manager. Stop your SQL Server instance if it is running.
  2. Right-click on your SQL Server instance and select Properties.
    SQL Server Configuration Manager
  3. In SQL Server 2014 or 2012, click Startup Parameters tab. Enter –m and then click Add.
    SQL Server 2014/2012 Startup Parameters
    If you've installed SQL Server 2008 (R2) or an earlier version, click Advanced tab and add -m; before existing value in Startup Parameters box, without any spaces.
    SQL Server 2008/2005 Startup Parameters
  4. Save your changes and restart the SQL Server instance. This will start SQL Server in single-user mode.
  5. Open an elevated Command Prompt and use the SQLCMD command to connect to your SQL Server instance:
    SQLCMD –S .\SQLEXPRESS
    Replace SQLEXPRESS with the name of your SQL Server instance.
  6. Here we'll create a new login called "tom" and then add this account to the SA server role. Run this command:
    CREATE LOGIN tom WITH PASSWORD='P@ssword123'
    GO
    SP_ADDSRVROLEMEMBER tom,'SYSADMIN'
    GO
    Create New Login in SQL Server Single-user Mode
  7. Once you've successfully performed these steps, the next step is to stop your SQL Server instance. Remove the -m you've added in Startup Parameters.
  8. Start your SQL Server instance. Open the SQL Server Management Studio and you can login using the newly created "tom" account. You now have SA access to your SQL Server instance. You may now reset the SA password and take control of your SQL Server box.
However, if you can't access SQL Server in single-user mode or can't log on Windows as administrator, this method won't work. In that situation, you need to use the SQL Server Password Changer program which enables you to unlock / reset SQL Server SA password offline.

Tuesday, May 6, 2014

How to Reset Windows Server Password After Forgotten

"I forgot my administrator password on Windows Server 2003 Enterprise edition. I tried many tricks available in the internet but still the password for my administrator account was not reset. Is it possible to get in?"
You might have forgot your Windows Server administrator password. When you lost the password, and still you will be able to log into the system if you have some other user accounts with administrators privilege. But when you have only one account and you lost its password, its difficult.

In this tutorial, we'll try to let you know some basics of Windows Server user account, so you can then smoothly reset Windows Server password without data loss.

Understanding Windows Server User Account

In Windows Server 2012/2008/2003/2000, there are two types of Windows user accounts:
  • Domain user accounts - A domain user account is one whose username and password are stored on a domain controller rather than the computer the user is logging into.
  • Local user accounts - In Windows, a local user account is one whose username and encrypted password are stored on the computer itself. When you log in as a local user, the computer checks its own list of users and its own password file to see if you are allowed to log into the computer.
Only domain controllers have both domain user accounts and local user accounts. Microsoft uses different encryption algorithms to secure these two types of Windows Server user account passwords and store them on different locations. As it's known to us, the local user accounts are saved in Windows SAM registry hive while the domain user accounts are stored in Active Directory database file (ntds.dit).

How to Reset Windows Server Password After Forgotten

If you've forgotten your Windows Server password, there is no need to worry. With PCUnlocker you can reset both local user account passwords and domain user account passwords easily. The program works with Windows Server 2012/2008/2003/2000, including 64-bit operating systems.
  1. You'll need to create a bootdisk using another PC (not your locked computer). If you don't have another PC, you'll have to borrow one of your friends. Then, you'll need to download the .zip archive of PCUnlocker on the computer, Unzip the download file and burn the ISO image to a blank CD/DVD using any ISO burning software.
  2. Boot your locked PC from the bootdisk (you might have to adjust the BIOS to allow booting from the CD).
  3. Just wait a while until the bootdisk launches the PCUnlocker program.

  4. If you want to reset domain user account passwords, choose the Reset Active Directory Password. Otherwise choose the Reset Local Admin/User Password option to reset local user account passwords.
  5. Select a user account from the list, and then click Reset Password button to reset your forgotten password.
Next restart your computer and remove the bootdisk, you'll be able to login your Windows Server user account immediately without reinstall the whole operating system.

How to Recover SA Password on SQL Server 2012

How to recover lost SA password on a SQL Server 2012 Express instance? If you've forgotten the login password for SA account, you are probably in a panic. Fear not, for you can reset the password and once again have access to the powers of the SA account by using a SQL Server password recovery program.

SQL Server Password Changer could be used to reset forgotten SA password on SQL Server 2000, 2005, 2008 (R2), 2012 and 2014. This article provides step-by-step instructions on how to reset SQL Server 2012 password without having any sort of administrator rights to the SQL instance.

How to Recover SA Password on SQL Server 2012?


SQL Server account passwords are stored in Master Database (master.mdf). Before getting started, you need to shutdown your SQL Server instance via SQL Server Configuration Manager. So we can then access the master.mdf file and reset lost SQL Server 2012 password offline.
  1. Click here to download and install the SQL Server Password Changer program on your computer.
  2. Click the Open File button. Select the SQL Server 2012 master database file (master.mdf). Typically it is located in the folder: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA.
    Select the SQL Server master database file
  3. The program will automatically decrypt the master database file and display all user accounts in your SQL Server. Select the SA account, click the Change Password button. Type a new password and click OK.
    SQL Server Password Recovery
  4. The program will replace the existing password with your new password, and also unlock your SA account if it's already locked out or disabled. Now start your SQL Server instance again and you can then log into the SA account using your new password.

How to Reset Forgotten SQL Server Password

Lost or forgot your SQL Server password? How to recover or reset SQL Server login password?

sa-locked-out

This is a common problem which is frequently asked in many sites. Many people forget their password shortly after installing Microsoft SQL Server or they have not used SQL Server after a long time. In this tutorial I'll show you two methods to reset forgotten SA password on SQL Server 2014, 2012, 2008 (R2), 2005 and 2000.

Method 1: Reset SA Password Using Windows Authentication
  1. Open SQL Server Management Studio, and select the authentication mode: Windows Authentication.
  2. Now click on the Connect button and you will be taken to the SQL Server Management Studio.
  3. In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties. sql-server-management-studio
  4. On the General page, you can create and confirm a new password for the login. If your SA account is locked out or disabled, switch to the Status page. Set "Login" to "Enabled" and uncheck "Login is locked out". Click OK. sql-server-login-properties

Method 2: Reset SA Password with Software

If you're unable to login with Windows Authentication and lost sysadmin privileges to your database, then it's a good idea to try the third-party software – SQL Server Password Changer. The program enables you to unlock / reset forgotten SA password on all SQL editions, including SQL Server 2012.

SQL Server logins are stored in the master database (master.mdf). In SQL Server 2012, you can find the master.mdf file in the directory of C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA. Before resetting SA password, you need to stop your SQL Server instance if it's running.

Download and install SQL Server Password Changer on your server. Start the program and click on the "Open File" button. In the pop-up dialog, select the master.mdf file for your SQL Server instance and click Open. The program will extract all your SQL Server user accounts from the master.mdf file.

sql server password recovery

Choose the SA account and click on "Change Password" button. In the Change Password dialog, enter a new password for your SA account and click OK. The program will update the password hashes for your login, and unlock SA account when it is locked out or disabled.

Now start your SQL Server instance and you can then log into SA account using your specified new password. That's it!