随便点开一个数据库,右键,新建查询,再输入下列代码 exec sp_attach_db @dbname = ‘dbname’, @filename1 = ‘mdf_file_route’, @filename2 = ‘ldf_file_route’ 如: exec sp_attach_db @dbname = ‘测试’, @filename1 = ‘D:\A\AAA\test.mdf’, @filename2 = ‘D:\A\AAA\test_log.ldf’