I have file.sql, and I want to restore it. I found this command:
mysql -u username -p database_name < file.sql
Where should I put 'file.sql' in file system? I'm using Windows and XAMPP. Thank you.
*) The dump file is 3GB++
Restore a backup Launch SQL Server Management Studio (SSMS) and connect to your SQL Server instance. Right-click the Databases node in Object Explorer and select Restore Database.... Select Device:, and then select the ellipses (...) to locate your backup file. Select Add and navigate to where your .
You can put it anywhere, where there is enough diskspace available of course.
A good place for this would be either /tmp
(on linux or similar) or c:\temp
(on windows or similar)
But assuming you use that exact line you need to change your working directory to that which holds the file.
cd /path/where/sql/file/is
And then
mysql -u username -p database_name < file.sql
If you don't have the mysql bin in your PATH you might want to run
/path/to/mysql/bin/mysql -u username -p database_name < file.sql
Or temporarily put the file.sql in the mysql bin directory (not recommended)
Another possible scenario is to point to the file in the filesystem like this
mysql -u username -p database_name < /path/where/sql/file/is/file.sql
PS. If you're on windows you might wanna change the forward slashes to backslashes.
You can put anywhere in the system but consider to change the command also
mysql -u username -p database_name < /somepath/file.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With