Running as Administrator on my machine, I can create databases just fine, but when I try to create a user it fails with this error message.
1> create user mark from login mark
2> go
Msg 15007, Level 16, State 1, Server ENDER\SQLEXPRESS, Line 1
'mark' is not a valid login or you do not have permission.
I’m using sqlcmd to do this.
You need to create the server login “mark” before creating a database user “mark”
e.g. For Windows Authentication
e.g. Or For SQL Server Authentication
Then once the login is created the following should work
By the way to get a list of server logins this is the query that management studio uses