Importing zipped files in Mysql using CMD

我与影子孤独终老i 提交于 2019-12-04 14:13:12

I needed to import from a compressed file as well, and stumbled upon your question. After a bit of messing around, I found that this worked for me:

7z x -so backup.7z | mysql -u root test

x is the extraction command
-so makes 7-zip write to stdout

Nothing wrong with your syntax, it's just a limitation with 7zip. It's better to use xz in this case, which doesn't put extraneous junk in stdout, or directly call the 7z.dll with your favorite programming language. 7z.exe is really meant for archive management, rather than unix-style piping, and Igor is very reluctant to change that.

If you try a plain 7z < somefile.7z you'll immediately see that all you get back is a usage list.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!