An error occurred while attaching the database to SQL Server. Error code: 5123, sql5123

Source: Internet
Author: User

An error occurred while attaching the database to SQL Server. Error code: 5123, sql5123

Today, when I attached a previous database (not in the directory where SQL Server was initially installed), I was always unable to append it, and there was always a 5123 error code,

At first, I thought it was because SqlServer2008 was not compatible with the original database because the database was not known to be created in that version. I read it on the official website and explained that the permission was incorrect, put the database in the directory where SqlServer is installed, that is, X: \ Program Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ DATA, which solves the problem; however, you cannot put the database in this directory every time! So I found other solutions;

Solution 1: This is the method just now. Put this file in the default location of SqlServer, but it is best not to put it on disk C. If you reinstall the system that day, it will be finished, haha;

Solution 2: It is to change the default database folder of the Sqlserver real column, select the Sqlserver instance, right-click the attribute, there is a "database Settings" on the left, after clicking it, there is a "default database location ", set this to your own directory.

Solution 3: Change the permissions of the folder where the database is located. Add an EveryOne user and set it to "full control". This solution is convenient and direct;

According to the editor of the customer's house, the third type is recommended for local testing. For the server, you still need to set the permissions.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.