Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create new SQL Server 2012 login without SQL Server Management Studio?

I have creating my system using Entity Framework code first for it create database automatic if it is not exist, but first, I need a user for access database

But I know only create user of SQL Server with SQL Server Management Studio, but I'm in a situation, where computer have SQL Server 2012 installed, but have not SQL Server Management Studio

What can I do for create a new database user without SQL Server Management Studio? Or have any solution with Entity Framework like it create database automatic?

like image 760
Lai32290 Avatar asked Aug 03 '26 15:08

Lai32290


1 Answers

To create a login from windows domain account using SQL Server Windows Authentication

CREATE LOGIN [Domain\Windows_UserName] FROM WINDOWS;
GO 

Then you have to Create A user with that Login

CREATE USER [Domain\Windows_UserName] FOR LOGIN [Domain\Windows_UserName];
GO

For Sql Server Authentication

CREATE LOGIN Login_Name WITH PASSWORD = 'ksblaksvfdh&';
GO 
like image 100
M.Ali Avatar answered Aug 06 '26 10:08

M.Ali