I have an existing SQL Server 2005, currently I am using in Windows Authentication and Db name is Restaurant. I know how to change existing SQL Server from Windows Auth to SQL Server Auth, but it doesnt locks the DB. Is there any way I can change my current SQL Server to SQL Server Authentication so as if any one tries to open Restaurant(DB) it'l ask for authentication. And also please tell me what needs to be connection string.
Thanks
SQL Server recognizes two modes of security:
If you want to enable SQL Server Authentication
on already installed database to allow custom username and password then you have to -
sa
user account Enable SQL Server Authentication Mode -
To Create New Login ID - Refer Create a Login
Disable Windows Authentication Login for BUILTIN Accounts -
Once you are logged in as sa
(system administrator) with password (remember password as you are going to disable Windows Authentication for Default Logins
), follow below steps -
Security
node and expand Logins
BUILTIN\\Administraors
OR BUILTIN\\Users
and select Properties
Status
from left pane. Disabled
under Login
No one from the Administrators group will be able to access your SQL Server now.
Referred MSDN Thread .
EDIT:
To Use Existing Login account sa
-
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<enterStrongPasswordHere>' ;
GO
Connection String -
Server=SERVER\SERVER_INSTANCE;Database=Restaurant;User Id=sa;
Password=password;
Refer - Connection Strings for Sql Server 2005
I would recommend to create a new account other than sa
and set its password.
use [master] GO
ALTER LOGIN [username] WITH PASSWORD='yourpassword', CHECK_POLICY=OFF GO
ALTER LOGIN [username] ENABLE GO
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.