How to change the location of the WSS 3.0 database files on SQL 2005 Embedded Edition
Dowload Microsoft SQL Server Management Studio Express from https://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en
Open management studio
Server Name - \\.\pipe\mssql$microsoft##ssee\Sql\query
1. Take a complete SharePoint Farm Backup and SQL back of SharePoint Databases
2. Stop the IIS admin service from Services Console
3. Stop the Windows SharePoint Service Administration from Services Console
4. Stop the Windows SharePoint Service Search from Services Console
5. Stop the Windows SharePoint Service Timer from Services Console
6. Detach the SharePoint databases and attach the same as follows:
use master
go
sp_detach_db 'SharePoint_Config'
go
use master
go
sp_attach_db 'mydb','E:\Sqldata\mydbdata.mdf','E:\Sqldata\mydblog.ldf'
go
7. Start all the services stopped in Step 2-5
References
https://support.microsoft.com/kb/224071
https://support.microsoft.com/kb/843580 (Specific to WSS 2.0)