mysql导入压缩文件,使用CMD在Mysql中导入压缩文件

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

jCrMu.png

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

ac45b314bbd4b5dc249b7b3f89a7989f.png

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值