Run the MS SQL Management Studio program

Connect to the selected SQL server instance.

In the "Object explorer" section under the name of the connected server, right-click on the Databases group and select the Attach command.

In the window that will open, we indicate the database file (mdf) that we want to operate on the server. 

The log file (ldf) will also be added to the list automatically.

Click OK. The connected database will appear in the server database list.

(PL version) Jak podłączyć plik bazy danych mdf do MS SQL Server