SQL Server 2005 mixed mode authentication - sql

just wondering is it possible to use mixed mode on sql server 2005 for user sa? I know how to do this in management studio but this isn't enough for user "sa". I think it needs done else where.
I am trying to connect to the database via a console app but keep getting the error "The account is disabled"
Cheers
Louis

Yes
http://msdn.microsoft.com/en-us/library/ms144284(v=SQL.90).aspx
How to:
http://msdn.microsoft.com/en-us/library/ms188670(v=SQL.90).aspx
If you didn't enable Mixed Mode Authentication during setup then you will need to do so in server properties > Security (you can use Management Studio - see above link). You will also need to enable the sa login and set an appropriate password.
Be sure to restart the SQL Service after changing the authentication mode for the changes to take effect.

If you are using SQL Express 2005 or you do not have SQL Server Management Studio installed you will need to update a registry key to enable Mixed Mode Authentication:
Open registry editor (launch
application %WINDIR%\regedit.exe) and
go to
HKLM\Software\Microsoft\Microsoft SQL
Server\MSSQL.1\MSSQLServer in the tree
on the left.
On the right, look for an entry named
LoginMode. The default value, when
installed is 1. Update it to 2. The
next step is to restart the service.
Launch your Service Manager (Start ->
Run -> Type services.msc) and look for
a service named MSSQL Server
(SQLEXPRESS). Restart the service.
Once the SQL Server service is restarted you then need to enable the sa account. Use the OSQL command line tool from an Administrator Command Prompt:
osql -E -S .\SQLEXPRESS
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<password>' ;
GO
You should then be able to test the login using:
osql -U sa -S .\SQLEXPRESS

If you SQL Server is already configured for Mixed Mode Authentication, then you just need to enable the sa user. You can find it in the Security->Logins folder.

Related

Why the default user can't login into sql server 2012?

I'm trying to run some PowerShell script to install some apps in my pc, the script is trying to create a user and roles for that user in sql server 2012, but I'm getting this error when I installed sql server in mixed mode authentication.
Getting bellow error when I installed the sql server in only windows authentication mode.
What can be the issue? Am I missing any settings?
The reason is written clearly:
cannot open database "Sessions" requested by login
Change it to master and retry

cannot enable login for sa

I am trying to install DNN using Web Platform Installer. It tries to connect to .\SQLEXPRESS, which I have installed along with SQL Server, and wants me password for sa. When I provide it
with a password, it says "password invalid or cannot connect to database".
I thought to myself there might be a problem with the sa account. I opened SSMS 2012. There is a red arrow downward sign on the sa account. Whenever I am trying to change login status to Granted it opens up an error message:
error 15151
Cannot alter the login 'sa' because it does not exist or you don't have permission.
Nonetheless I tried it with administrator account and also by disabling UAC. None worked. Screen shot follows:
Details:
SQLEXPRESS version: 10.0.2531
SQL Server version: 11.0.2100
Update: Following some guidelines I tried to change authentication in SQL Server Management Studio from Windows Authentication to Mixed Authentication, but it failed with the following permission error:
Make sure you're connecting with a server login that has the sysadmin server-level role. You'll need that permissions level to do what you're trying.
Check the server authentication mode. If it is or was Windows Auth only, the sa account is automatically disabled. Note that if SQL Authentication was disabled and later turned back on, the sa account will still be disabled.
If you find that nobody is in the sysadmin server-level role, you'll need to stop the server and restart it in single-user mode so you can add at least one login to the sysadmin server-level role. In single-user mode, the Administrators group has sysadmin access, but you'll have a limited subset of commands to manipulate data in tables (single user is for fixing servers, not running applications). NB: Only one connection is allowed in this mode, so if you have a broker or service that's trying to connect you'll need to disable that or it can take the session you were planning to use with SSMS.

Can't log into SQL server after changing computer name

I installed Windows Server 2008 and SQL Server 2008 R2, after joining to domain I changed computer name and mistakenly I deleted the administrators group from SQL Server login users and now I am not able to login.
Any suggestion?
I know this is old but I just used the Gui instead.
Step 1. Start SSMS
Step 2. Select the server name drop down and click browse more.
step 3. select local or network tab based where the server is and expand Database engine and select the correct computer name\sql server
Follow the steps in this article: http://v-consult.be/2011/05/26/recover-sa-password-microsoft-sql-server-2008-r2/
Basically you have to modify the SQL Server Service settings so that it starts in admin mode. This will only allow one connection to it. Once you start it up you can create a new sysadmin user that you can use from then on.
Also I do know that you need to run certain scripts on a SQL Server if you change the hostname of the server. You should find them if you google them.
If you have mixed mode authentication enabled on the SQL Server instance, you can login using the sa account, with the password that you specified during installation.
If you have only Windows authentication enabled, I'm not sure. You could try running setup again and seeing if it will let you change the authentication mode, but somehow I doubt that it will let you do anything without first connecting to the instance with your Windows identity.
As a last resort, you could try uninstalling and re-installing the SQL Server instance, then re-attaching all your databases.
Add the new name of the computer and you should be able to login again..

Sql Server Management Studio Express

how do i convert my sql server management studio express to server authentication mode.. please help regarding this..
I assume you mean SQL or Mixed-mode Authentication (the ability to login using your SA account). Follow the instructions in this link.
You should be able to connect to it as normal via whatever method you already have (this requires sufficient Admin permissions).
Then to enable access via SQL Logins you can
Right click on the instance name in Management Studio (mine is localhost\SQLEXPRESS (SQLServer 10.0.1600)).
Go to the Security tab.
Then you should be able to enable SQL Logins by clicking SQL Server and Windows Authentication Mode.
Click ok and you're done!
You can now add SQL Logins as connect via them as you would normally.

CF9 + SQL Server Express

I just created a new database in "Microsoft SQL Server Management Studio Express" and now I'm in "ColdFusion Administrator" and I'm trying to add my database as a Data Source. How do I do that? I believe the servername is .\SQLEXPRESS but I'm not sure what the default username and password are. I've tried creating a new login through Management Studio with an actual username and password, but those aren't working either. The error I'm getting is:
Connection verification failed for data source: xxx
java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]The requested instance is either invalid or not running.
The root cause was that: java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]The requested instance is either invalid or not running.
I can see that the service is running, and I can connect to it through management studio. I've tried following a couple tutorials online, but they don't seem to be working for me. Ideas?
Server name can be any resolvable hostname or domain name, in case of having SQL Server and CF server on same box localhost should work for you.
Also make sure that user you created has access to the particular database and needed operations. Look into the database permissions for this. This check is not required when using master account (often login is sa), but this is not recommended practice because of the security reasons.
Also make sure SQL Server and Windows Authentication mode is checked. I had an issue with permissions as well when I only had Windows Authentication enabled under:
right click on server (localhost) -> security
Then restart SQL Server Services to save changes. After that I was able to connect my ColdFusion datasource to SQL Server.
For testings sake use the same credentials that you are connected with in Management Studio, likely the "sa" user and password. Once you have it working with "sa" then go back into Management Studio and create an application level user for your CF app and then update the data source to use your new user / password.