An error occurred in connecting to the SQLserver database, prompting user sa login failure solution (useful for pro-testing)

When using eclipse to create a project to connect to the database, it prompts user sa to log in failed. After searching online for a long time, I finally solved it.

The following are some ways I have summarized to solve the problem:

Step 1: First start the Microsoft SQL Server 2008 database; first use Windows authentication to log in as shown in the figure.

 

 

Step 2: Modify the attribute; select the security in the number directory on the left, open the directory , select sa , right-click the mouse, and select the "Property" option, as shown in the figure below:

 

In the dialog box that pops up, change the password used for SQL server login to 123456, and uncheck Enforce password policy , as shown in the following figure:

Then click on the left to select the page status to enable the login below , and click OK , as shown in the following figure: 

 Step 3: After modifying the properties, go back to the Windows login interface and select the connection, then select the database engine (as shown in the figure below) and select SQL Sever authentication for authentication , the login name is sa, the password is 123456, and click to connect. As shown below:

 

Step 4: After logging in to the database with SQL Sever authentication, select the database  in the tree directory on the left, right-click the mouse, and select "Attach" , the "Attach Database" dialog box will pop up, click "Add" to select the database file , database file .mdf file in the folder (here is my own database, you can add your own database, our file name is different), click the "OK" button. As shown below:

 

 

After the above steps are completed, then you can run the program you wrote in eclipse.

Like it if you find it useful.

Guess you like

Origin blog.csdn.net/m0_61625235/article/details/120968244