使用CMD在Mysql中导入压缩文件 [英] Importing zipped files in Mysql using CMD
问题描述
我尝试使用命令提示符使用以下命令将压缩的数据库文件导入到Mysql中
7z< backup.sql.7z | mysql -u root test
用户 具有任何与其相关联的密码。
是我的目标空白数据库。
我使用 7zip 解压缩目的。
压缩的数据库,即backup.sql.7z位于D盘。
但它给出以下错误
所以,我使用下面的命令
7z< backup.7z | mysql -u root test
注意:这次我使用 替换 >但是,我得到以下错误
显然,我的SQL语法有问题。
那么正确的语法是什么呢?
我需要从一个压缩文件导入,并偶然发现了你的问题。
经过一些麻烦,我发现这对我有用:
7z x -so backup.7z | mysql -u root test
x 是提取命令
-so 将7-zip写入stdout
I am trying to import zipped database files into Mysql using command prompt using the following command
7z < backup.sql.7z | mysql -u root test
The root user don't have any password associated with it.
test is my target blank database.
I use 7zip for unzipping purpose.
The zipped database i.e. backup.sql.7z is located in D drive.
But it's giving the following error
So, instead I used the following command
7z < backup.7z | mysql -u root test
Note: This time I am using backup.7z instead of backup.sql.7z
But then I get the following error
Clearly there's something wrong with my SQL syntax.
What will be the correct syntax to use then ?
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
这篇关于使用CMD在Mysql中导入压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!