Importing zipped files in Mysql using CMD
What is the right syntax to import sql zipped files into mysql using cmd ?
I am doing the following
xz < backup.sql.gz | mysql -u root test
But always getting the following error
Import compressed file data into SQL Server. We want to load data from ZIP file into SQL Server table, therefore, add a Data Flow Task and connect it with the File Unzip Task. Rename Data Flow Task to Import Excel into SQL Server. Double click on the Import Excel into SQL Server.
To import a file, open Workbench and click on + next to the MySQL connections option. Fill in the fields with the connection information. Once connected to the database go to Data Import/Restore. Choose the option Import from Self-Contained File and select the file.
Try:
unzip -p dbdump.sql.zip | mysql -u root -p yourdbname
The dbdump.sql.zip should contain a single SQL file. The -p flag pipes the output into the mysql binary.
I got the answer from my other question. This is the command to import zipped file when you are using 7zip
7z x -so backup.7z | mysql -u root test
x is the extraction command
-so
option makes 7-zip write to stdout
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