Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default username and password of my SQL Server Express?

It installed automatically with Visual Studio 2010 Ultimate. I didn't create any users for the server or ANYTHING.

I'm using:

string connectionString = @"Server=.\SQLEXPRESS;Database=SportsStore;Trusted_Connection=yes;";

I get error that authentication failed. So the server is being found, but my credentials are wrong. What would the default login and password be?

Edit: Still not working! :(

Here's my connection string:

string connectionString = @"Server=.\SQLEXPRESS;Database=SportsStore;Integrated Security=SSPI;";

And the error message:

Cannot open database "SportsStore" requested by the login. The login failed. Login failed for user 'ToshibaLaptop\Sergio'.

like image 738
Sergio Tapia Avatar asked Aug 07 '10 14:08

Sergio Tapia


3 Answers

You probably should not connect using Sql Server Authentication.

Log in as an Administrator on the box, connect using Integrated Windows Authentication, and you should be a system admin.

like image 171
Dave Markle Avatar answered Oct 13 '22 00:10

Dave Markle


If you are using SQL Server authentication you could try the username sa and blank password but I am not sure whether this is by default. Integrated Windows authentication should work, so you should be able to connect with your Windows account:

string conn = "Data Source=.\SQLExpress;Initial Catalog=mydb;Integrated Security=SSPI;";
like image 45
Darin Dimitrov Avatar answered Oct 13 '22 00:10

Darin Dimitrov


The error message indicates that SQL Server can't open the database. I think you're successfully authenticating, but having a problem connecting to the database. Is the database available?

You can do a test by changing the database to master in your connection string. If that succeeds, then you're problem is related to the database. I understand that you may get other errors, but the test is to confirm that you can login to SQL Server.

like image 24
bobs Avatar answered Oct 13 '22 01:10

bobs