Enable binary mode while restoring a Database from an SQL dump

后端 未结 17 1632
耶瑟儿~
耶瑟儿~ 2020-12-07 14:41

I am extremely new to MySQL and am running it on Windows. I am trying to restore a Database from a dumpfile in MySQL, but I get the following error:

$ >m         


        
相关标签:
17条回答
  • 2020-12-07 15:10

    The file you are trying to import is a zip file. Unzip the file and then try to import again.

    0 讨论(0)
  • 2020-12-07 15:11

    I had this error once, after running mysqldump on Windows PowerShell like so:

    mysqldump -u root p my_db --no-data --no-create-db --no-create-info --routines --triggers --skip-opt --set-gtid-purged=OFF > db_objects.sql
    

    What I did was change it to this (pipe instead to Set-Content):

    mysqldump -u root p my_db --no-data --no-create-db --no-create-info --routines --triggers --skip-opt --set-gtid-purged=OFF | Set-Content db_objects.sql
    

    And the problem went away!

    0 讨论(0)
  • 2020-12-07 15:12

    Extract your file with Tar archiving tool. you can use it in this way:

    tar xf example.sql.gz
    
    0 讨论(0)
  • 2020-12-07 15:12

    If you don't have enough space or don't want to waste time in decompressing it, Try this command.

    gunzip < compressed-sqlfile.gz | mysql -u root -p
    

    Don't forget to replace compressed-sqlfile.gz with your compressed file name.

    .gz restore will not work without command I provided above.

    0 讨论(0)
  • 2020-12-07 15:12

    Its must you file dump.sql problem.Use Sequel Pro check your file ecoding.It should be garbage characters in your dump.sql.

    0 讨论(0)
提交回复
热议问题