How can I move a SQL Server LocalDb database from one machine to another?

前端 未结 2 855
梦毁少年i
梦毁少年i 2020-12-11 11:54

I have a SQL Server database that was created from VS2012. I located the database files for that. I would like to back up the database and move it to a different machine.

相关标签:
2条回答
  • 2020-12-11 12:36
    $server = 'KALLESPC\SQLEXPRESS'; or $server = '.';
    $link = mssql_connect($server, 'sa', 'phpfi');
    if (!$link) {
        die('Something went wrong while connecting to MSSQL');
    }
    
    0 讨论(0)
  • 2020-12-11 12:41
    1. Backup your database from original machine 1) Open SQL Server Management Studio, connect to your (LocalDb), select your database then right-mouse-click, choose Tasks -> Back Up ... 2) Remember the Destination path in Back Up Database dialog, then click OK

    2. Copy the created .bak to your target machine

    3. Install SQL Server on your target machine if it's not installed previously

    4. Do the opposite operation Restore on your target machine 1) Open SQL Server Management Studio, in Object Explorer, select Databases, then right-mouse-click, select Restore Database, open Restore Database dialog 2) Give a name to To Database 3) Under Source for restore, choose From device, then browse to your copied .bak file, then click OK

    0 讨论(0)
提交回复
热议问题