Error when trying to create new Login user for SQL 2012

sqlcmd: error: microsoft odbc driver 13 for sql server login failed for user
sql server error 18456
is not a valid name because it contains invalid characters.
is not a valid windows nt name. give the complete name domain username
login failed for user sql server
connectionerror: login failed for user
how to create user in sql server 2012 step by step
unable to login with sa sql server

I'm trying to follow the procedures described in this link here but if I enter IIS APPPOOL\AppPoolName as the login name (as in step 3) it throws an error saying that it is not a valid name because it contains invalid characters. I'm using SSMS for SQL 2012.

UPDATE: Just to clarify: The "Invalid character" error was b/c I was trying to enter the user on "SQL Server Authentication" when it must be "Windows Authentication".

here is some sample TSQL code from one of my blogs to create a login and user. http://craftydba.com/?p=656

It does not like the . Put in in brackets. []

-- Delete existing login.
IF  EXISTS (SELECT * FROM sys.server_principals WHERE name = N'BSA_USER')
DROP LOGIN [BSA_USER]
GO

-- Add new login.
CREATE LOGIN [BSA_USER] WITH PASSWORD=N'M0a2r0c9h11#', DEFAULT_DATABASE=[BSA]
GO

-- Delete existing user.
IF  EXISTS (SELECT * FROM sys.database_principals WHERE name = N'BSA_USER')
DROP USER [BSA_USER]
GO

-- Add new user.
CREATE USER [BSA_USER] FOR LOGIN [BSA_USER] WITH DEFAULT_SCHEMA=[dbo]
GO

Change the syntax for a Windows Account.

-- Using users naming ...
CREATE LOGIN [APPPOOL\MyAppPool]
FROM WINDOWS
WITH DEFAULT_DATABASE = [MyDatabase]
GO

Trying to add a new SQL Server user throws the error "is not a valid , Before adding a User you must first create a global Login, under Security -> Logins. Once the login exists you can add them as a User under a particular  I am trying to add a new user to an SQL Server 2012 database using SQL Server Management Studio. I right-click and select 'Add User' under Security -> Users, fill out the user information, and click OK. Management Studio throws the the error message "is not a valid login or you do not have permission”. How can I add this user?

Ben answered his own question:

UPDATE: Just to clarify: The "Invalid character" error was b/c I was trying to enter the user on "SQL Server Authentication" when it must be "Windows Authentication".

Can't create user in SQL Server, After creating the database, I try to create new user and assign the login I use but I was halted by this error. share. An attempt was made to use a Windows login name with SQL Server Authentication. 7: Login is disabled, and the password is incorrect. 8: The password is incorrect. 9: Password is not valid. 11: Login is valid, but server access failed. 12: Login is valid login, but server access failed. 18: Password must be changed.

I had the same problem when creating a Windows domain user in SSMS.

This solved it:

https://social.msdn.microsoft.com/Forums/en-US/8f084029-b0cf-4e7d-bb07-a11e31363660/tsd03072-xxxxxxx-is-not-a-valid-name-because-it-contains-invalid-characters?forum=vstsdb

Synopsis: The error message is misleading, the error case is that the for the situation where you have a Windows login and the (userName != loginName). The code does not take casing into consideration right now, so they have to be an exact match.

"Login failed for user" error message when you log on to SQL Server, The user is not associated with a trusted SQL Server connection. RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT Scenario 2: You are trying to connect by using SQL Server Authentication but the login  Google says, in SSMS, expand the database, right click Security and go to New User. However, when I do this and try to create a user, I choose SQL user with login, enter a username and login name, and get the error: 'news_login' is not a valid login or you do not have permission

Error when you try to connect to an instance of SQL Server: "Cannot , Each user has a default database. When you connect to computer that's running Microsoft SQL Server, and you do not specify a login database,  Now, I was able to add the login from SSMS or using CREATE LOGIN. A key point here is step #2, the netdom command needs to be run from the machine whose machine account password you want to reset. To reset a machine account password, you need someone with domain admin credentials.

How to Fix Login Failed for User (Microsoft SQL Server, Error: 18456 , How to Fix Login Failed for User (Microsoft SQL Server, Error: 18456) Step-By- Step – Add SQL Administrator to SQL Management Studio To get a list of users on the machine (Assuming Windows Server 2012 or above) Try logging onto windows with that account that is Built-in account for administering then we can  The last scenario, when we try to drop a database user that owns a database schema and also this schema is referenced by a database object. In our demonstration here, if we will try to drop the MSSQLTipsUser database user simply by applying the below DROP USER statement:

Troubleshooting Microsoft SQL Server Error 18456, Login failed for , Are you getting an error when trying to log in to Microsoft SQL Server (MSSQL)? Sometimes, the error presents as “login failed for user '<username>',” this you to login to the server or at least be able to make a Windows  Here is a sample of what happens when I try to create a database . Create Database PetitionSample. Msg 262, Level 14, State 1, Line 1. CREATE DATABASE permission denied in database 'master'. I used to be able to create databases, create new users and so on.

Comments
  • Thanks for your reply. Here is the msg after I executed your script: Msg 15006, Level 16, State 1, Line 2 'IIS APPPOOL\MyAppPool' is not a valid name because it contains invalid characters.
  • Please see above, if windows account, add FROM WINDOWS. I gave you a code snippet above, Please try again.
  • I got his error : Windows NT user or group 'LAPTOP-N48A3H8V\AspNetCore' not found. Check the name again.