Can't login in SQL Server Management Studio - sql-server

I am trying to create a login in SQL Server Management Studio. I was successful in the creation, but after that I can't login in it. I will leave the steps below
Fixed the problem. Solution

Check your server Properties --> Security --> Server authentication
If SQL Server and Windows Authentication mode selected you will be fine.
If not, Follow steps below:
Right-click on your server
Go to option Security
Check the option "SQL Server and Windows Authentication mode"
Click on Ok button
Restart SQL Express Service ("Windows Key" on keyboard and write "Services", and then Enter key)
After SQL services restarted, you should be able to login with user and password

These are the steps to take to create a login:
Click right on database ,choose security , choose SQL with Windows authentication and Both failed....
Restart SQL Server service
Create database
Create login and a sign the name of database to the user from choosing "Default Database"
Be sure you a sign to user mapping database
Server name :
if local choose the name of computer name that you choose from first if you do not know choose from drop list of server name to see what available name
if you have a ip static put the server name like that :000.00.00.00\\SQLSERVER2019,1433, name and password.

Related

Use windows authentication in windows service

When running tomcat 7 as a windows service I can connect SQLServer with SQLServer Authentication but when connecting through Windows Authentication it seems to fail.
From what I know process running under windows services are user independent and run under a user named "SYSTEM" . Is there a way I can add SYSTEM to SQLServer users ?
Every thing seems to work if I run the code via Eclipse i.e. Under a user process.
You need to add a new Login of your Machine (Machine where your service is running) on MS SQL Server machine.
For example your are on domain "DomainName" and your hostname is "MachineName", you need to add a new Login "DomainName\MachineName$" on SQL Server. Note the $ sign at the end indicates that this is a computer name.
Follow the Steps below to add a new login on MS SQL Server:
Open SQL Server Management Studio and Login as 'sa' user.
Open Security -> Logins
Right Click on Logins and New Login...
Enter the Login name "DomainName\MachineName$" in General Tab
Select Windows Authentication radio box
Select tab "Server Roles" and check the box against "sysadmin"
OK and then Restart your SQL Server Service.

Unable to log in to server in SQL Server 2008 R2 Management Studio

I have a SQL Server 2008 R2 instance and can log in using the sa user. But I want to define another user (administrator) to log in with SQL Server Management Studio, so I did the following:
Logged in to the server in Management Studio as sa.
Right clicked on the database name.
Clicked on properties.
Then under permission, I select the required username (administrator).
And I grant him all the permission.
But when I tried to log in using administrator, I got the following error:
Login failed for user “administator” Error 18456.
Can anyone advise what might be the problem?
If the server encounters an error that prevents a login from succeeding, the client will display the following error mesage.
Msg 18456, Level 14, State 1, Server <server name>, Line 1
Login failed for user '<user name>'
This usually means that your connection request was successfully received by the server name you specified but the server is not able to grant you access for a number of reasons and throws error: 18456.
This eventID sometimes provides also state 1 which actually isn’t that useful as due to security reasons any error is converted to state 1 unless you can check logging on the server.
Microsoft does not provide very useful message boxes so below are some explanations why you get the error.
Invalid userID: SQL Server is not able to find the specified UserID on the server you are trying to get. The most common cause is that this userID hasn’t been granted access on the server but this could be also a simple typo or you accidentally are trying to connect to different server (Typical if you use more than one server)
Invalid password: Wrong password or just a typo. Remember that this username can have different passwords on different servers.
less common errors: The userID might be disabled on the server. Windows login was provided for SQL Authentication (change to Windows Authentication. If you use SSMS you might have to run as different user to use this option). Password might have expired and probably several other reasons….
18456 state 1 explanations: Usually Microsoft SQL Server will give you error state 1 which actually does not mean anything apart from that you have 18456 error. State 1 is used to hide actual state in order to protect the system, which to me makes sense. Below is a list with all different states and for more information about retrieving accurate states visit Understanding "login failed" (Error 18456) error messages in SQL Server 2005
SQL Authentication not enabled: If you use SQL Login for the first time on SQL Server instance than very often error 18456 occurs because Windows Authentication (only) is set in Server properties (security section).
To Access Server Properties,
- Open SQL Server Management Studio, go to Object Explorer pane (use view if you can’t see it).
- Use the connect button to connect to database engine for your server. Once connected you will see it in object explorer.
- Right click server and click properties. Server Properties window will appear.
See below screenshot that might be causing SQL login to fail
You should set Server Authentication to SQL Server Windows Authentication
To resolve this error follow the steps below on computer with SQL Server 2005.
Create new user with Administrator privilege with same username and password as of SQL Server 2008 in operating system.
On SQL Server database create new user by expanding DatabaseNode >> Security >> Login >> - Create New User and add this new user with Windows Authentication radio button selected. - This user can be only added by selected Windows Authentication it is Operating system’s User Login.
Once above two steps are completed when connected from SQL Server 2008 to SQL Server 2005 using Windows Authentication it will connect successfully.
How to fix? Check this link video SQL Server and Windows Authentication Mode page.
Source
You need to add a server login:
Connect to your SQL Server with SSMS as sa.
Drill into the server's Security folder in SSMS's Object Explorer pane.
Right-click on the server's Security > Logins folder that appears in Object Explorer.
Click on New Login... in the context menu that appears.
Provide details of the new login in the Login - New dialog that opens - particularly its General, Server Roles, and User Mappings pages (along the left). (See the screenshots of each page with sample input at the bottom of the answer.)
You may need to add a database user depending on your needs, but a server login (like your sa login) is necessary to connect to the SQL Server instance using Windows or SQL Server authentication. Mapping the new login to a database user (in the Login - New dialog's User Mappings page) will create a new user in the mapped database if you specify a username that does not already exist; alternatively you can map the new login to an existing database user.
Another SO question speaks to the differences between server logins and database users.
Login - New (General page)
SQL Server authentication
or
Windows authentication
Login - New (Server Roles page)
Login - New (User Mappings page)
SQL Server authentication
or
Windows authentication

Dotnetnuke Installation; Microsoft SQL Server 'sa' Account Problems

So I've been tasked to install DNN onto my system. I am using the Microsoft Web Platform Installer. I am being asked for the password for the 'sa' account. I do not know the password for the account. So when I tried to use the Microsoft SQL Server Management software to change the password I get the following message:
"Change password failed for Login 'sa' (Microsoft.SqlServer.Smo)
Additional Information:
An exception occurred while executing a Transact-SQL or batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot alter the login 'sa', because it does not exist or you do not have permission. (Microsoft SQL Server, Error: 15151)"
How would I obtain permission to change the password? Or am I missing the point entirely and should be doing something else to install the software??
I would assume the issue lies with SQL, what steps should I take to rectify this problem??
SQL Server uses either/both of "Windows authentication" and "SQL Server authentication".
By default, MSSQL installs with ONLY "Windows authentication". "sa" requires MSSQL authentication.
SOLUTION:
http://technet.microsoft.com/en-us/library/ms188670.aspx
1) Go into SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
2) On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
3) In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
4) In Object Explorer, right-click your server, and then click Restart.
Are you able to login via Windows Authentication and change it that way? If so, that would be the best way to do it.
If the only account that has admin access is the sa account though, then you can try starting SQL server in single user mode and then resetting the sa password. Note that this method requires local admin access to the server itself.
http://sigkillit.com/2013/01/02/recover-sa-password-on-microsoft-sql-server/
Sounds to me like you could login with the SA account into SQL server, it will likely prompt you to change your password (first time logging in) and then you would be good to go after that.
That being said, I never recommend setting up DNN to connect to SQL server with the SA account. Each DNN database should have its own DB user, that way if one DNN install gets compromised for some reason, they can't reach out into other databases on the same server.
EDIT: a little more info
From http://www.christoc.com/Tutorials/All-Tutorials/aid/1
In SQL Server you should go through and create a new database. I always create a database with the same name as the website, so in this case DNNDEV.ME. Once you have created the database, create a user that can access that database. I always use SQL authentication, turn off the enforce password requirements, and give the user DB Owner and Public access to the DNNDEV.ME database. Remember the username and password you create here as you will need them when you walk through the Installation screen for DotNetNuke.

Cannot login after creating the user in SQL Server

My problem is I cannot login into SQL Server after I've created a user. The user creation is successful, since the new user is listed under security/logins.
How to solve this issue ???
Login failed for user 'sims'. The user is not associated with a
trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
SQL Server was not configured to allow mixed authentication. Here are steps to fix:
Right-click on SQL Server instance at root of Object Explorer,
click on Properties.
Select Security from the left pane.
Select the SQL Server and Windows Authentication mode radio button, and
click OK.
Open up Services and restart the SQL Service (SQLEXPRESS) Windows service.
Try setting your authentication mode to mixed mode. Your server does probably not accept logins using sql server accounts.
Open properties
Go to "Security"
Select "SQL Server and Windows Authentication mode"
Right click Server for properties...
properties

SQL Server 2008 can't login with newly created user

I'm using using Windows Vista and I'm having trouble logging in with a newly created user.
I open SQL Server Management Studio.
I create a new Login by right-clicking on Security->Logins.
Check: SQL Server Authentication
Login name: tester
Password: test
Click OK
I added this user to User Mapping to my database of choice.
Click File -> Connect Object Explorer, select SQL Server Authentication and enter tester/test and click Connect.
I get an error:
Login failed for user 'tester'. (Microsoft SQL Server, Error: 18456"
with Severity = 14 and State = 1.
What causes this error and how do I login with my user?
SQL Server was not configured to allow mixed authentication.
Here are steps to fix:
Right-click on SQL Server instance at root of Object Explorer, click on Properties
Select Security from the left pane.
Select the SQL Server and Windows Authentication mode radio button, and click OK.
Right-click on the SQL Server instance, select Restart (alternatively, open up Services and restart the SQL Server service).
This is also incredibly helpful for IBM Connections users, my wizards were not able to connect until I fxed this setting.
If you haven't restarted your SQL database Server after you make login changes, then make sure you do that. Start->Programs->Microsoft SQL Server -> Configuration tools -> SQL Server configuration manager -> Restart Server.
It looks like you only added the user to the server. You need to add them to the database too. Either open the database/Security/User/Add New User or open the server/Security/Logins/Properties/User Mapping.
You'll likely need to check the SQL Server error logs to determine the actual state (it's not reported to the client for security reasons.) See here for details.
Login to Server as Admin
Go To Security > Logins > New Login
Step 1:
Login Name : SomeName
Step 2:
Select SQL Server / Windows Authentication.
More Info on,
what is the differences between sql server authentication and windows authentication..?
Choose Default DB and Language of your choice
Click OK
Try to connect with the New User Credentials, It will prompt you to change the password. Change and login
OR
Try with query :
USE [master] -- Default DB
GO
CREATE LOGIN [Username] WITH PASSWORD=N'123456', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO
--123456 is the Password And Username is Login User
ALTER LOGIN [Username] enable -- Enable or to Disable User
GO

Resources