SQL Server 2008 SSMS won't remember password - sql-server

SQL Server 2008 doesn't remember password inspite of checking the "Remember Password" checkbox.
I was suspecting a reboot would solve the problem. But, the issue persists.
Environment: Windows Vista Ultimate, SQL Server 2008
I have been hesitant to post this, as it seems so trivial and weird.

There is a solution for this in SSMS 2012 that worked for me. Microsoft now provides a mechanism for removing a server from the list of remembered servers, and removing the offending server from the list will allow you to save the password the next time you connect to it:
In the Connect to Database Engine dialog, drop down the server name list
Use the arrow keys to select the server for which passwords aren't remembered
Press the delete key on the keyboard.
https://web.archive.org/web/20160216044501/http://blogs.msdn.com/b/managingsql/archive/2011/07/13/deleting-old-server-names-from-quot-connect-to-server-quot-dialog-in-ssms.aspx

If you register the server, and connect to it that way (just a quick double click), it works great!
In SSMS -> View | Registered Servers
Choose "Database Engine" (should be selected by default)
Right click on "Local Server Groups" and choose "New Server Registration" (or create your own group first if you prefer)
Enter all required details: Server address, username, password, tick "Remember password" box, Registered server name
Click "OK" -- now you can always connect to this server from this "Registered Servers" tool window - it will not ask for a password again.
I got this from serverfault.com and it worked great!

Does this bug report match what you're seeing?
EDIT (January 10, 2015): Ganesh points out in a comment that this link is now dead. This decade-old bug was closed as “Won’t Fix,” but it has been reposted/reopened here. (I put a screenshot of the cached page here, for anyone who’s interested.)

I believe I found the solution to this problem.
If your SQL Server seems to have forgotten your passwords, try this:
At the log on screen, click on the down arrow of the Logon selection box.
Do not select a logon name right away.
Wait a few seconds.
Then select the logon name from the list.
Your password will appear in the password box.
Why does this strange behavior occur? I believe SQL Server may have to poll accounts and does not do it in time when you click immediately on the log on name.

The SSMS 2012 answer didn't work for me since I'm on 2008 R2. However, I did find a way to "fix" it. It's not a true fix, but if you keep a backup of the file, you can always restore it very easily if one of the servers loses your credentials.
Important Note:
While playing around trying to find out WHY/WHEN it actually does lose credentials, I found that it seems to always remember the last used username that has never been used for that specific server using your profile. For example, if you start with a fresh profile, and you connect to a server called MyServer, and you begin by using sa for the username, regardless of if you check "remember password" or not, if you log in successfully with sa, it seems that SSMS now stores that in memory. Now if you use the username Tester and log in successfully, it will always open by default with Tester as the user.
Now for the fix/workaround:
First, check out this article, but I recommend that you DON'T DELETE the file, just rename it to SqlStudio.bin.OLD or something, so you can always restore it to check any settings that would have been reset using this method.
MY Approach:
I first renamed my bin file like I recommended. Then, I opened SSMS and logged in to every server that I use most often, using the credentials I always want to use for those servers, and selected "Remember password" for each one. I then made a BACKUP of the bin file, and store it in a secure place on my network. This way, if I ever need to log in to a server with another username for testing or whatever, I can easily restore my original bin file afterward. Or, if you want, before you use the new username, you could just rename the bin file and do your work as the new user. Once you're done, just delete the new bin file and rename your original back to .bin and you'll be good to go.
The key is to get a good version of your bin file and make a backup. If you ever add a new server, you can log in using the same approach as above, using your desired credentials and remember password, and then copy the bin file to the backup location. Hope this helps!

You can remove user setting completely and SSMS will be able to remember new logins. Be aware this way you'll lose all the saved ssms logins.
User settings location is
%APPDATA%\Microsoft\SQL Server Management Studio\[you ssms version here]\UserSettings.xml

For me, I solve my problem by running "SQL Server Manage Studio" (SSMS) by Admin right (right click, Run as Administrator) and tick check box "Remember password", type password and connect.
Then the next time I run SSMS normally and boom, no need to type password again.
It seems that SSMS have problem writing credential and run as Administrator do solve it.

This worked for me:
I went to Control Panel -> Credential Manager, in the "Windows credentials" category then "add a Windows credential" and manually created a record with:
IP
User
Password
and then SSMS started to remember the password

Related

Can't see backup folder in MS SQL Server 2019 [duplicate]

I am trying to run a classic asp project on visual studio and therefore I am trying to restore a database. I cannot seem to find the .bak file when trying to restore it. It wasn't visible in the C-drive. I have looked it up and have seen that it has something to do with permissions. I have tried enabling permissions after properties>security of .bak file to 'Everyone', it did not work. I have also tried NT Service\MSSQLSERVER. Please see the following below.
I had the same issue. I get to know that it was a a permissions issue.
Here are the following steps to solve this problem
Go to Control panel > Administrative Tools > Services double click on the services.
copy the log on account name of sql service as shown in the picture.
Go to your backup folder and right click and select properties.
Follow the steps as shown in picture.
After clicking on edit you will get new window.
Click on add
Paste here the Log on account name of sql service account which you had copied earlier. then Click on check name button.
Select MSSQLSERVER then click ok.
Now you will get your sql server account name in security tab.
Select sql server account name that and in permission box select Allow in all check boxes(I added Full Control) then click apply.
Now you will be able to select and restore your backup file.
You also have to enable permissions to the folder where the file is located. SSMS first needs to browse the folder, then to read the file.
In your case, SQL server tries to access the folder using NT Service\MSSQLSERVER account, so permissions should be granted to that account, no need to give more permissions (to everyone).
Also try below if above doesn't help:
close/open SSMS
move the file from root to some folder and grant permissions to that folder
use TSQL script to restore the database instead of SSMS
you can copy the backup folder in to C:\Users\MSSQL$HCMIS\Desktop sql server users folder.Now it will be accessible
I'm facing simpler issue for sql server standalone 2014 enterprise edition ,installed in my home system . I tried every possibility provided in various article but strangely the issue is with my 2 named instance .
I can restore database on my default instance with query and GUI . I tried changing log-on as account of sql server service for named instance to 'network service' or 'local system' and giving them full control permission to backup holding folder .
In my (and probably a typical/common case): I looked through (and compare with other .bak files) in the windows permission and see nothing wrong.
However - This may be due to that one does not follow to restore from the [device] option first. Even you store the .bak in the right path, it is initially from the [Source]->[Database] check box, until you follow the steps to restore via the [device] option
(In my case the second AdventureWorksDW2020-DAX-Docs was not available until I go thru extra steps to restore it via the [Device] option first.)
The SQLserver need to do internal access right grants to users... etc..(even all the needed Windows properties are in place) –
Reference https://learn.microsoft.com/en-us/sql/samples/adventureworks-install-configure?view=sql-server-ver16&tabs=ssms

MSSQL Single user mode block

I am a web design so I dont understand almost nothing of servers and stuff.
I was working with MSSQL Server and ASP.NET to create a form that save its information in a database. But it was failing because my account in MSSQL was asking "Please change your password" because it had a "Enforce password expiration". I needed the "sa" account password to change it (I was using SQL Authentication) but I didnt know about the "sa" password.
I searched in Internet and I found out about "single user mode". I added the "-m" to the startup parameters but I am so stupid that I forgot about stop sql agent.
Result? I cant use MSSQL now. Neither with administration account. Is there any way to solve this problem?
I am so sorry about this and thanks so much to who try to help me. :)
Did you add this via configuration manager? You should be able to just edit the startup parameters again and restart the service, and it should come back online in multi user mode.
Edit: Just checked and this definitely works.
Launch SQL Server Configuration Manager
Right click your SQL Instance > Properties
On the Startup Parameters tab, remove the -m flag youve added
Click OK, OK to apply
Right click the service and click restart
You will be back in multi user mode.

How do you get Management Studio to actually use the default database/catalog for a user's login?

This is relatively similar to questions such as these:
How can I change my default database in SQL Server without using MS SQL Server Management Studio?
https://superuser.com/questions/364825/sql-server-management-studio-ignores-default-db
That being said, Management Studio is ignoring all the suggestions. I'm logging in as sa, and I can see that the default catalog for sa is being changed successfully, but Management Studio ignores these changes in the dropdown:
Even if I change it to specific_database_name, and even if I can look at the sa login Properties menu and see that it's set to specific_database_name, Management Studio will always default that combo box to master.
I've tried:
Exec sp_defaultdb #loginame='sa', #defdb='specific_database_name'
ALTER LOGIN sa
WITH DEFAULT_DATABASE = specific_database_name
Going into the Properties menu for login sa in Management Studio and setting it in the dropdown box there.
The OP in the second question eventually fell back to using a batch file to log in as a different user, but I'd personally just rather keep having master show up. Also he did mention being able to set this on the connection properties themselves, but it's greyed out on my system, and I seem to remember being able to set this for an individual user a long time ago on another machine.
How can this be set? Note that this is not using a Windows login, but a SQL Server one instead. Thanks.
I don't know why these methods are not working. Just to be sure I just did the following (on SQL Server 2012 enterprise)
1) Created Login test and assigned x1 as default database
2) Added login test to database x1 (and made test a member of datareaders)
3) Reopened SSMS - Logged in as Test
4) Opened query window - was placed in x1.
You really want to make users default to a database that is not a system database - otherwise they will attempt to create objects in Master which is something you really want to avoid.

How to remove cached server names from the Connect to Server dialog?

Or, to put it another way, where is SqlStudio.bin for SQL Server 2012? It doesn't seem to be in the place that would be expected by looking at this other SO question.
As of SQL Server 2012 you no longer have to go through the hassle of deleting the bin file (which causes other side effects). You should be able to press the Delete key within the MRU list of the Server Name dropdown in the Connect to Server dialog. This is documented in this Connect item and this blog post.
To be clear, since a couple of people seemed to have trouble with this for months: You need to click on the Server name: dropdown, and down-arrow or hover with your mouse until the server you want to remove is selected, and then press Delete. In this screen shot, I'm going to press Delete now, and it will remove the server ADMIN:SHELDON\SQL2014 from my MRU list. Note that because I merely hovered with my mouse, this is not even the server that is showing in the Server name: text box.
Note that if you have multiple entries for a single server name (e.g. one with Windows and one with SQL Auth), you won't be able to tell which one you're deleting.
Found it!
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\SqlStudio.bin
So the answer is as before: delete the file, or use some nifty PowerShell magic to edit it.
As for SQL Server Management Studio v18 it appears this file is now XML and you can edit it directly:
%APPDATA%\Microsoft\SQL Server Management Studio\18.0\UserSettings.xml
If you want to remove particular account or update password on Windows 10 then you can go to Windows Credentials in Credential Manager and update or remove related entry:
Control Panel >> Credential Manager >> Windows Credentials >> Microsoft:SSMS
This is the best way to clear these server names from the list.
Open the(SSMS) version. Mine is 18.
You should be right where you can see the server name dropdown list.
If not, you will open the Connect to Server dialog located in the File menu bar
Click on the Server Name field dropdown list.
"Hover over" (very important) the items you want to remove.
Pressing the delete (DEL) key on your keyboard should do the trick.
You're welcome

"Cannot open user default database. Login failed." after installing SQL Server Management Studio Express

I have a database in a local file that is used by a program. The program has limited functionality and I needed to run some quick queries. I installed SQL Server Management Studio Express 2005 (SSMSE), connected to the SQL Server instance, attached the database file, and ran the queries. Now the original program will no longer connect to the database. I receive the error:
Cannot open user default database. Login failed. Login failed for user 'MyComputer\MyUserName'.
I've gone back into SSMSE and tried to set the default database. I've opened up Security, Logins, BUILTIN\Administrators and BUILTIN\Users. Under General, I have set the default database to the program's database. Under User Mappings, I made sure the database is ticked and that db_datareader and db_datawriter are ticked.
The program uses the connection string:
Server=(local)\Instance; AttachDbFilename=C:\PathToDatabase\Database.mdf; Integrated Security=True; User Instance=True;
I know jack-all about database administration. What else am I missing?
This may not be answering your question specifically, but it may help others with similar issue caused by different problem
In my case the problem was my user is defaulted to a database which is not accessible for any reason (can be renamed, removed, corrupted or ...)
To solve the issue just follow the following instruction
Try to login again on the login page there is other tabs select
"Connection Properties".
under the tab locate "Connect to database" and select an existing database you have access to like tempdb or master
Once you are connected to the SQL Server Instance execute the below TSQL to assign the login a new default database.
Use master
GO
ALTER LOGIN [yourloginname] WITH DEFAULT_DATABASE = TempDB
GO
Alternatively once you connected change your default database name to master via UI
Article taken from :
http://www.mytechmantra.com/LearnSQLServer/Fix-cannot-open-user-default-database-Login-failed-Login-failed-for-user-SQL-Server-Error/
This problem manifested for me when I took my default db offline. Next thing I know I couldn't login. Switching to the Connection Properties tab and selecting the drop down to change the database I want to connect to also failed.
It let me in right away once I manually typed master as the db I wanted to connect to (on the Connection Properties tab).
First, try to isolate your problem:
Take a backup of the file! Some of the steps below can, apparently, in some circumstances cause the file to vanish.
Are you sure you are connecting to the same instance through Management Studio as the program is?
If possible, try to shut down the instance that you are not expecting to use.
Set the user's default database to master and try to make the program logon.
Try to login as the user through Management Studio - since you have integrated security, you should open Management Studio as the program's user.
Are you using "User instances" - perhaps without knowing it? If so, this may be helpful: http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
I haven't worked much with files being attached in the way your program does - but you write that you attached the DB in the Management Studio as well. Have you tried detaching it there before running your program? Perhaps you are seeing the Management Studio and your program competing for exclusive access to the MDF-file?
EDIT: I added point 6 above - this is new in my own list of TODOs when troubleshooting this type of Login failed. But it does sound a lot like what you're experiencing.
EDIT2: In the first edit, new item was added to the list. So the numbers in the comments doesn't correspond with the numbers in the answer.
I finally figured this out, and my situation is different than every other I've read about tonight.
I had restored my database from a backup. I knew that there was a particular login user that I had been using, so I created that user in SSMS. However, there was already a user by that name under the database that had come in with the backup.
Since I had screwed around so much trying to fix this, I wasn't able to delete the user under the DB easily. I deleted the database and restored again. Then:
Delete the user under the Databases->[my database]->Users
Create the user again in Security->Logins (not under your DB, although that probably works too.
Go to the newly created user. Select properties. Then under User Mappings, tell it to make your database the default. Give it read and write access.
Summary: I had two users. One that came with the DB, and one that I had created. Remove the one that came with the DB and create your own.
First click on Option>> Button of “Connect to Server” Prompt.
Now change the connect to database to any existing database on your server like master or msdb.
More Details
https://blog.sqlauthority.com/2008/11/04/sql-server-fix-error-4064-cannot-open-user-default-database-login-failed-login-failed-for-user/
I've also had this same problem, it turned out that I was trying to access the built in membership classes (in a view), and that .Net was trying to create the database in the App_Data folder:
#Membership.GetUser().ProviderUserKey
This will trigger the system to try and create a database based in the built in membership system, which may not be the way your system is setup.
I had a similar problem had to simply download SQL Express Utility that is capable of starting User Instances. SSEUtil is a tool written by the Visual Studio team to help troubleshoot User Instance issues, you can read more about it in the read me file that is installed with the utility.
http://www.microsoft.com/downloads/details.aspx?FamilyID=fa87e828-173f-472e-a85c-27ed01cf6b02&DisplayLang=en.
Hope this will help.
In my case I had to set "connect to any database" right path:
On your instance, go to Security , then to Logins.
Right Click on there, you will see properties and you should click on Securables.
There it give possibility to connect to any database.

Resources