• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

sql connection error failed

can't connect to database  user login failed vmboojtwin1206\administrator
how do I fix this in the database I created it work but when I would link a database that I restored I have a login error ? how to add SQL user on database

data source = vmboojtwin1206;initialcatalog= a;integrated security =true; user id = ? (user_admin) ; password = (User password)
1 Solution
Brian CroweDatabase AdministratorCommented:
--Create the login at the server level using SQL authentication
CREATE LOGIN <username> WITH PASSWORD = '<password>';


--Create the login at the server level with Windows authentication
CREATE LOGIN [<domainName>\<loginName>] FROM WINDOWS;

--Create the database user
USE <databasename>;
CREATE USER <username> FOR LOGIN <username>
   WITH DEFAULT_SCHEMA = <schemaname>;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now