How to create a local user?
mySQL | Explanation | SQL Server |
CREATE USER 'username'@'localhost' IDENTIFIED BY 'passwordstring'; | Create a new user, local to the server machine | CREATE LOGIN username WITH PASSWORD=N'passwordstring', DEFAULT_DATABASE=[master]; |
In my experience, if you want a login specific to only the local machine, you would create a SQL Server login, and then connect to the local instance of SQL Server using SQLCMD or OSQL, which is what I've scripted here.
In thinking about this, I suppose you could create a local machine user, and then create a SQL login for that local user. However, as logins for that login would be exclusively from the local machine, the only use cases I can think of for this approach would be either a) development scenarios, or b) embedded systems.
The syntax for that would look like
CREATE LOGIN [machinename\username] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
No comments:
Post a Comment