简体   繁体   中英

Can you import sql.gz dump file in Windows cmd?

Does anyone know if it is possible to import a sql.gz file into MySQL on Windows via CMD?

mysql -v -u root -p db_name < prod_dump_local_20171011.sql.gz

but i get

ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.

I assume because it does not know how to handle the.gz file, I can extract it but its 10gb so if there is a way to import without doing that would be good.

First step. Install gzip for windows: I recommend using chocolatey to do it: ( https://chocolatey.org/install )

choco install gzip -y

Now you can descompress your gz file and send it to mysql:

gzip -cd backup.sql.gz > mysql -uUSER -pPASSWORD -hLOCALHOST DATABASE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM