Error connecting to SQL server with MSSQL and PHP

$myServer = "sql2008";

//$myUser = "zach";
//$myPass = "pass";

//$myUser = "DOMAIN/zach";
//$myPass = "pass";

//$myUser = "";
//$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

Couldn't connect to SQL Server on sql2008. Error: Login failed for user ''.


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

2 answers

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.



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: LMuu3zBDlLIn5M: & imgrefurl = http: // // 360 & vpy = 292 & dur = 1302 & hovh = 212 & hovw = 238 & tx = 161 & ty = 115 & sig = 103098649454558437088 & page = 1 & tbnh = 129 & tbnw = 146 & start = 0 & ndsp = 21 & ved = 1t: 429, r: 15, s:

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



All Articles