Create a login using command prompt (CMD)

Scenario

You have got the SQL database engine installed but no SSMS installed on it. In this scenario how you will connect to the target database engine and create a login to allow a connection or how will you connect to SQL database engine without SSMS.

Solution

Create a login using the command prompt.

The below steps are to create a login using Command Prompt.

Open CMD and type the below command to connect to the Database engine

then hit enter

if you see “1>” in the next line, then you are now connected to the SQL engine.

Now type the below command to create the login and give a permission

hit enter.
Then type the below command to add the “SYSADMIN” permission.

then type

and hit enter.

Screenshot for your reference:

Login creation using CMD
Login creation using CMD

Now this created a login for you and you can connect to the Database engine from another server

Now verify if the login is created

Open CMD and type the below command to connect to the Database engine

Now type below command to see if your login got created.

You will get the list of logins present on this SQL instance as shown in the below screenshot.

SQL login verification using CMD
SQL login verification using CMD
Facebook Comments Box

Comments

Leave a Reply

Your email address will not be published.