The SQL default restore location is the folder a database engine pre-fills when you open a restore dialog or run a restore without an explicit path. To change it, you alter a server-level setting, not a per-query option: in SQL Server you edit the registry-backed default directories or use MOVE clauses in RESTORE DATABASE; in PostgreSQL and MySQL you redirect the underlying data directory or rely on pg_restore --directory and mysqldump output paths. The key condition is that the service account must already have read and write access to the new directory before any restore will succeed. The rest of this guide walks through each major engine, with verification steps and the failure modes that trip people up most often.
What "default restore location" actually means in each engine
The phrase hides three different mechanisms, and mixing them up is the fastest way to waste an afternoon.
In Microsoft SQL Server, the default restore location is a pair of server properties: InstanceDefaultDataPath and InstanceDefaultLogPath, which the engine inherited from the registry keys DefaultData and DefaultLog under the instance's MSSQLServer setup key. When you open the SSMS restore wizard, the "Restore As" column is populated from those paths. A RESTORE run without WITH MOVE writes files to the paths recorded inside the backup header, which usually match the original server's layout rather than your new default. That distinction matters: changing the server default affects the GUI's suggestions and newly created databases, but a bare restore can still land files wherever the backup says.
PostgreSQL has no restore dialog and therefore no configurable "restore location" in the SQL Server sense. pg_restore accepts --directory=DIR for directory-format archives and otherwise writes to the connection's default database. Physical restores via pg_basebackup write to whatever -D you supply. So the practical equivalent is choosing your output directory at command time, and, for a permanent change of where data lives, relocating the data directory itself.
MySQL and MariaDB follow the same pattern: mysqldump output goes wherever your shell redirection points, and mysql < dump.sql reloads into the server's configured datadir, which is set in my.cnf/my.ini. Changing the restore destination means changing datadir (a restart-level operation) or explicitly choosing a database name on import.
SQLite, being file-based, has no server default at all; the "restore" is copying a file to a path you pick.
Once you know which mechanism your engine uses, the procedure is short. Let's take them in order of how often the question comes up.
SQL Server: change the server default paths
Prerequisites
You need sysadmin rights, an elevated registry editor session (or the SQL Server Configuration Manager), and a target directory that already exists on a volume with enough free space for your largest expected restore. Create the folder first; SQL Server will not create a missing default directory during restore and fails with operating system error 3 (the system cannot find the path specified). Confirm the service account—often NT Service\MSSQLSERVER for the default instance or NT Service\MSSQL$INSTANCE for a named one—has Full Control on the new folder. Also plan a maintenance window: the registry change requires a service restart to be reflected reliably in all code paths.
Steps
1: Record the current values so you can roll back: 2: Create the new directories in File Explorer or with mkdir, for example D:\SQLData and D:\SQLLogs. 3: Grant the service account modify rights on both folders. In the folder's Security tab, add the account and check Modify; inheritance from the parent volume is usually enough, but explicit is safer. 4: Open Registry Editor and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQLServer. The MSSQL16 segment corresponds to SQL Server 2022; use MSSQL15 for 2019, MSSQL14 for 2017, and so on. For a named instance the key becomes MSSQL16.INSTANCENAME. 5: Edit the string values DefaultData and DefaultLog to your new paths. Do not add a trailing backslash. 6: Restart the SQL Server service (net stop MSSQLSERVER && net start MSSQLSERVER, or via Services). 7: Re-run the query from step 1 to confirm the properties now report the new paths.
Success check and rollback
After the restart, create a scratch database with CREATE DATABASE TestDefault; and confirm its files appear in the new data folder. Then drop it. If the paths didn't take, the usual causes are a wrong instance key, a typo in the value name, or a service restart that didn't actually complete. Rollback is simply restoring the two registry strings to their recorded values and restarting again. Treat registry editing as the reversible-check stage: if the service fails to start afterward, revert immediately rather than debugging under pressure.
The MOVE clause: the part that actually controls restore targets
Even with the default changed, RESTORE DATABASE honors the file paths stored in the backup set unless you tell it otherwise. The reliable method is RESTORE FILELISTONLY followed by explicit MOVE:
The logical names in MOVE must match what FILELISTONLY returns exactly; a mismatch produces error 3234 or "Logical file name not found." This is the step that catches most people who changed the default and still saw files land on C:. The server default only influences the SSMS wizard's suggestions and the placement of newly created databases.
For a permanent, scriptable approach, wrap the restore in a stored procedure that queries RESTORE FILELISTONLY into a temp table, builds the MOVE list dynamically with QUOTENAME, and executes it. That way every restore lands in your chosen directory regardless of where the backup originated.
PostgreSQL: choose output at restore time and relocate the data directory
PostgreSQL doesn't present a default restore folder, so "changing" it means changing your process.
For logical restores, pg_restore with a directory-format dump writes into the directory named by --directory:
For plain-SQL dumps, psql -f dump.sql reads from wherever the file sits; there's no destination directory to configure. If you want a house convention, set it in your restore scripts and document it, because the server won't enforce one.
The permanent change—where the cluster's data actually lives—is a datadir relocation done with initdb's output path or by moving an existing cluster. On Debian/Ubuntu, pg_lsclusters shows the current data directory, and pg_ctlcluster plus the data_directory setting in postgresql.conf control it. On RHEL-family systems the PGDATA environment variable and the systemd unit's Environment= line govern it. Move the directory while the server is stopped, preserve ownership (postgres:postgres in most distributions), and update SELinux contexts with restorecon -Rv /new/path if SELinux is enforcing—otherwise the server starts but refuses connections, and journalctl -u postgresql shows permission denials.
MySQL and MariaDB: datadir and import destinations
mysqldump writes to standard output, so the "restore location" is just shell redirection on the way in:
The server-side destination is datadir, defined in the [mysqld] section of my.cnf (typically /var/lib/mysql on Linux). Changing it means stopping mysqld, copying the existing data with rsync -a preserving ownership (mysql:mysql), updating datadir and often socket, and restarting. AppArmor on Ubuntu and SELinux on RHEL will block the new path until you adjust their profiles—/etc/apparmor.d/usr.sbin.mysqld or semanage fcontext -a -t mysqld_db_t. Skipping that step produces a server that starts, logs permission errors, and exits.
A lighter alternative for one-off restores is to import into a different schema (mysql -e 'CREATE DATABASE staging' then import there) and let datadir stay put. That's often the right call when the real goal is "keep restores off my production volume" rather than "relocate the whole cluster."
SQL Server on Linux and Azure SQL: paths you can and can't touch
SQL Server 2017 and later on Linux stores its default paths in /var/opt/mssql/mssql.conf, under [filelocation] with defaultdatadir and defaultlogdir keys. Edit the file, then systemctl restart mssql-server. Ownership must remain mssql:mssql, and the directories must be writable by that account. The MOVE clause behaves identically to the Windows version.
Azure SQL Database and Azure SQL Managed Instance don't expose a filesystem, so there's nothing to modify; restores are logical (.bacpac import or RESTORE ... FROM URL into a new database). If your question came from following a SQL Server tutorial while working in Azure, the answer is that the setting doesn't exist there and the tutorial's registry step will fail.
Common failures and how to diagnose them
Operating system error 5 (access denied) or 3 (path not found). The service account can't reach the folder, or the folder doesn't exist. Check effective permissions with icacls "D:\SQLData" on Windows; on Linux use namei -l /new/path to see each component's mode. Reversible first step: grant rights on a test subfolder and retry a small restore.
Files still restore to the old location after changing the registry. You didn't restart the service, you edited the wrong instance key, or you ran a bare RESTORE without MOVE. Verify with the SERVERPROPERTY query, then add MOVE.
Error 3154 or "the backup set holds a backup of a database other than the existing." Unrelated to paths, but common when restoring over an existing name; add REPLACE only after confirming you intend to overwrite.
PostgreSQL "could not change directory" or permission denied on pg_restore --directory. The postgres user can't write the target; chown postgres:postgres the directory and re-run.
MySQL starts then immediately exits after a datadir change. AppArmor/SELinux denial or wrong ownership. Check journalctl -u mysql (or mysqld.log) for Permission denied on the new path; fix the policy rather than disabling enforcement.
Restores succeed but slowly, or fill the volume. The new default is on a smaller disk than expected. Compare free space with df -h before large restores, and remember that SQL Server needs room for both the .mdf and .ldf plus transaction log growth during the operation.
Name a stop condition: if the SQL Server service won't start after a registry edit—especially with error 1067 or a "cannot open file" message pointing at master—revert your change immediately and restore the registry from backup rather than attempting a repair install. If you're unsure which instance key you edited, stop and confirm the instance name with SELECT @@SERVERNAME and SELECT SERVERPROPERTY('InstanceName') before touching anything else.
Choosing the right approach for your situation
If your goal is a smoother SSMS experience when restoring backups from other servers, change the registry defaults but rely on MOVE clauses in your restore scripts—the two together cover both GUI suggestions and unattended restores. If you're consolidating restores onto a dedicated volume with more space, the same combination applies, plus a capacity check against your largest backup set.
If you're relocating an entire PostgreSQL or MySQL data directory, treat it as a planned maintenance operation with a tested backup, ownership verification, and security-policy updates, not a quick config tweak. And if you're on Azure SQL or SQLite, recognize that the concept doesn't map and adjust your expectations rather than hunting for a setting that isn't there.
The one thing all engines share: the destination directory must exist, be writable by the database service account, and be large enough. Verify those three conditions before you change any configuration, and you'll avoid the errors that account for most failed attempts to modify the default restore location.