Mysql ERROR: ASCII '\0' while importing sql file on linux server

前端 未结 3 1270
感情败类
感情败类 2021-01-01 18:37

I am getting following error while importing sql file

ERROR: ASCII \'\\0\' appeared in the statement, but this is not allowed unless option --binary-mode is         


        
相关标签:
3条回答
  • 2021-01-01 19:11

    Try something like :

    mysql -u root -p -h localhost -D database --binary-mode -o < dump.sql
    

    and make sure your sql file is not zipped.

    0 讨论(0)
  • 2021-01-01 19:12

    I just had this issue because the file was gzipped. I unzipped it and had no further issue.

    0 讨论(0)
  • 2021-01-01 19:31

    I encountered this problem,the sql file was in a valid ISCII format, I solved as the following:

    1- in shell use file command to detect type of data contained in the dump file:

    file db.sql

    got output like following:

    db.sql: Little-endian UTF-16 Unicode text, with very long lines, with CRLF line terminators

    2- convert the existing dump file to UTF8 (ASCII) using iconv:

    iconv -f utf-16 -t utf-8 db.sql > db_utf8.sql

    then import the new file.

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