Ubuntu with SQL Server error with AD Authentication - sql-server

I have a problem to connect my SQL Server 2017 on Ubuntu server 16.04 with the active directory located on a Win Server 2012 essential.
I always got this error : I'm specifying my server, select Windows Authentification, then :Login failed. The login is from an untrusted demoain and cannot be used with Integrated authentication. (Microsoft SQL Server, Error: 18452)
I've checked for hours to fix this issue and still nothing.
Here's the step I followed:
Ubuntu Installation basic with samba, standard system utilities
and OpenSSH server
SQL Server 2017 express installation : I followed the guide here
I joined my company domain : I followed the guide here
I tried to link SQL Server to the Active directory : I followed the guide here
If you need more information, I can provide krb5.conf, smb.conf, etc. files
Thanks in advance for your help.

I finally found the problem ... oufffff after hours of research to find out that I had to add another SPN with only the servername and port
Like setspn -A MSSQLSvb/SQL-SERVER_NAME:1433 accountServiceName
So I added this one with the other with the fqdn...
Hope this will help someone, one day!!!

Related

SQLServer with DBeaver. Login failed for user 'sa'. ClientConnectionId:

I'm trying to connect to SQLServer with DBeaver on MacOS using these settings:
And I keep having the same error:
"Login failed for user 'sa'.
ClientConnectionId:bab6f002-ac7c-4125-b8e8-169c498e79bc"
I read online about changing the Security in the Proprieties and putting SQL Server and Windows mixed authentication, but I could not found the Security settings on DBeaver. The menu in the image just have either Windows or SQL Server authentication but not a mixed one.
The string after "ClientConnectionId" keeps changing.
I solved the problem by setting the Server Safety into SQL Server and Windows Authentication mode.
Image of the option in the UI
I think maybe when I install it choose use only Windows Authentication mode cause.
This worked for me:
1) Go to Microsoft SQL Server Management Studio:
Choose your connection, right click -> Properties -> Security -> Server authentication -> Pick radio button "Sql Server and Windows Authentication mode"
2) After that go to SQL Server Configuration Manager:
SQL Server Services -> restart SQLEXPRESS and MSSQLSERVER
I had the same problem but on debian 11. I fixed it by installing the ODBC driver
https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16#debian18
I solved the problem by putting the host to 0.0.0.0
I found the IP writing
docker ps -a
in the terminal and looking at the PORTS field of the SQL container I created.
Thanks for the hint on what the problem was.
I had this same issue but I solved it by changing my password. I had # in my password and it somehow was not able to use it.
Just leaving it here for others. I know it's pretty basic but it might help someone!
I did not have the combined Windows and SQL authentication option but I used this Github answer instead. The trick was to change the authentication to NTLM.

I cannot find SQL Server browser

I have installed SQL SERVER 17.
I'm trying to connect to a remote Database and I was not able to do so. After research, I found out that it requires the SQL Server Browser service to be started but I couldn't find the service in the SQL Server Configuration Manager
I also tried searching for missing SQL Browser Service. So, I tried reinstalling the SSMS but I couldn't find any option to select for SQL Browser.
Also, I don't have the sqlbrowser.exe file at location 'C:\Program Files (x86)\Microsoft SQL Server\90\Shared\'. So, I guess it wasn't installed from the start.
Any solution, on how to install the service?
EDIT 1 :
This is the error message on the SSMS:
I have verified and made sure that the username and password is correct.
EDIT 2 :
I tried to turn of my firewall and then connect with the server. But, I still got the same error.
So, I tried to reinstall the complete SQL SERVER. During the installation, I selected the custom mode and selected the SQL Server Browser to be automatic. So, now I have it working.
Now, still having my firewall disabled, I tried connecting to the SERVER, but still I got the same error.
Now the question is why am I getting this error?
Final EDIT :
Sorry for all the trouble but I have posted the answer to the problem, Thanks.
You do not need to install SQL browser to simply connect to a remote database, it allows you to see SQL server instances on your machine.
In management studio, adding the hostname and credentials in the connection dialog box is enough and if they are correct, and you have access, it will connect.
really sorry for the trouble.
And the problem was a slash ( \ ).
I spent couple of hours trying to figure out what's wrong with the connection and all that time I used SERVER / INSTANCENAME and everything else was perfect... and suddenly when I was searching online someone had made a same mistake and I looked at my hostname and it was wrong.
It should be SERVER \ INSTANCENAME with a backslash ( \ ).

The target principal name is incorrect. Cannot generate SSPI context

I have a small home network of pc's all running Windows 10. None of the PC's have been or are in a domain. One (an intel NUC) runs Sql Server and my Surface 3 has Visual Studio. I use my Microsoft login for both. This setup has been running fine for almost 2 years.
Now I suddenly get the above error when trying to connect using integrated security.
Sql Authentication works fine.
I can also remote into the NUC and run SSMS without a problem.
I have followed the troubleshooting guide without success (KB 811889)
NTLM seems to be operating OK on the NUC.
I pinged -a IPAddress and it resolved correctly to the name of the NUC
SQL Server uses NT Service\MSSQLSERVER. I tried using LocalSystem but still didn't work
All the help articles I have found assume there is a domain or suggest Sql Authentication as a solution.
Only recent change has been installing Windows Update for Windows 10 Version 1607 on the NUC
Can anyone help me?

SQL Server login failed in Windows Server 2012

I have a problem to login to SQL Server 2014 Express edition using a SQL Server user.
I have this problem in Windows Server 2012. In normal Windows machine I can create user and login. I changed the authentication mode to mix and did the all thing in Internet but still I got login error.
Error Number: 18456
Severity: 14
State: 1
Line Number: 65536
If anyone can please help me.
How are you trying to connect? Is there any connection string? And Do you check connectting with udl file.
For testing with udl file follow below:
Create a new txt file.
Change its extension to udl.
Run it.
Select Microsoft OLE DB Provider for SQL Server in Provider tab.
Enter your entries.
Service of SQL Server (MSSQLSERVER) must be started in your services.
If udl file works, I think you need to reinstall SQL Server. [from comment]
I found the problem. It was conflict with previous installation instant. After I remove everything and reinstall SQL again make it work.

SQL Server 2008 - Login failed. The login is from an untrusted domain and cannot be used with Windows authentication

I've just installed SQL Server 2008 Developer edition and I'm trying to connect using SQLCMD.exe, but I get the following error:
H:\>sqlcmd.exe -S ".\SQL2008"
Msg 18452, Level 14, State 1, Server DEVBOX\SQL2008, Line 1
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
The SQL Server instance is configured to use SQL Server and Windows Authentication mode. If I specify -U sa then I can log in successfully, but I'd like to use windows authentication. Connecting using SSMS with windows authentication seems to work fine.
I had this issue and it was because the machine running the application isnt trusted for delegation on the domain by active directory. If it is a .net app running under an application pool identity DOMAIN_application.environment for example.. the identity can't make calls out to SQL unless the machine is trusted.
You're not passing any credentials to sqlcmd.exe
So it's trying to authenticate you using the Windows Login credentials, but you mustn't have your SQL Server setup to accept those credentials...
When you were installing it, you would have had to supply a Server Admin password (for the sa account)
Try...
sqlcmd.exe -U sa -P YOUR_PASSWORD -S ".\SQL2008"
for reference,
theres more details here...
In my case, this error was caused by renaming my client machine. I used a new name longer than 13 characters (despite the warning), which resulted in the NETBIOS name being truncated and being different from the full machine name. Once I re-renamed the client to a shorter name, the error went away.
Just tried this:
H:>"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe" -S ".\SQL2008"
1>
and it works.. (I have the Microsoft SQL Server\100\Tools\Binn directory in my path).
Still not sure why the SQL Server 2008 version of SQLCMD doesn't work though..
Your error is quite literally saying "you're trying to use Windows Authentication, but your login isn't from a trusted domain". Which is odd, because you're connecting to the local machine.
Perhaps you're logged into Windows using a local account rather than a domain account? Ensure that you're logging in with a domain account that is also a SQL Server principal on your SQL2008 instance.
Do you specify a user name and password to log on? What exactly is your complete command line?
If you're running on your own box, you can either specify a username/password, or use the -E parameter to log on with your Windows credentials (if those are permitted in your SQL server installation).
Marc
I was getting this error too, although my issue was that I kept switching between two corporate networks via my Virtual Machine, with different access credentials. I had to run the command prompt:
ipconfig /renew
After this my network issues were resolved and I could connect once again to SQL.
Just found this thread and posted an alternative answer (copied below) here:
https://stackoverflow.com/a/37853766/1948625
Specifically on this question, if the dot "." used in the -S value of the command line means the same as 127.0.0.1, then it could be the same issue as the connection string of the other question. Use the hostname instead, or check your hosts file.
Old question, and my symptoms are slightly different, but same error. My connection string was correct (Integrated security, and I don't provide user and pwd) with data source set to 127.0.0.1. It worked fine for years.
But recently I added a line in the static host file for testing purposes (C:\Windows\System32\drivers\etc\hosts)
127.0.0.1 www.blablatestsite.com
Removing this line and the error is gone.
I got a clue from this article (https://support.microsoft.com/en-gb/kb/896861) which talks about hostnames and loopback.
Other possible fix (if you need to keep that line in the hosts file) is to use the hostname (like MYSERVER01) instead of 127.0.0.1 in the data source of the connection string.

Resources