We faced this error while restoring a database in Sql Server using the .bak(backup) file but into a different database.
The way it was resolved for us was to
1) Selecting Options within Restore Database dialog box.
2) Specifying correct path to the mdf and log file for the database.
3) Checking Overwrite the existing database option.
That’ s it ..
One way of doing it is through sql server management studio explained over here
But if you haven’t installed the management studio than in that case you need to make following change in the registry
HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Microsoft SQL server / MSSQL.1/ MSSQLSERVER/ LoginMode
Click on it change it’s value from 1 to 2.
Then Restart your sql server service !!!
After you have done this you need to enable you sa account for sql server authentication for this follow these steps
1) Open SQL Server Management Studio Express and Login
2) In Object Explorer, click Security followed by Logins
3) Right click sa user and select Properties.
4) Uncheck Enforce password policy
5) Select Status. Click the Grant and Enabled radio buttons. Click OK
6) Restart your database server and select restart.