Error connecting to SQL server with MSSQL and PHP
$myServer = "sql2008";
//$myUser = "zach";
//$myPass = "pass";
//$myUser = "DOMAIN/zach";
//$myPass = "pass";
//$myUser = "zach@DOMAIN.net";
//$myPass = "pass";
$myUser = "sa";
$myPass = "pass";
$myDB = "Database";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer. Error: " . mssql_get_last_message());
So, I noticed that I can connect to SA (server admin), but I cannot connect to my username, which is a domain user that has many permissions.
the only giving me an error is when the username is zach@DOMAIN.net.
Couldn't connect to SQL Server on sql2008. Error: Login failed for user 'zach@DOMAIN.net'.
which makes me think there must be some setting on the server that allows logins, but I don't know where to look.
* UPDATE ****
So, after looking at SQL Server Management Studio, I realized that it accepts logins from the sysadmin server role group. So I added my AD account to the group, but I was still unable to reach my username. I have used the three approaches listed above. is there a fourth option?
That being said, is there a way that I can tell that it is connecting to a non-sysadmin group? for security reasons I would rather not connect to sysadmin?
source to share
The solution I found was SQL Server, didn't like that I was trying to use a domain account. I figured out that whatever SQL user account I created works fine, just when I try to use AD accounts it doesn't work.
I'm sure some people will want to use AD, but I don't need it in this situation.
source to share
Go to login account properties, there should be some kind of status tab with grant and deny option ... I don't have SQL on this PC. It looks something like this:
I am not in Active Directory, but I tried adding an DOMAIN/GROUP
account login on the SQL server. Take a look at this post, it teaches how to add a username for a group on a domain. How to add an Active Directory user group as a login to SQL Server
source to share