MySQL 5.7.12 import cannot create a JSON value from a string with CHARACTER SET 'binary'

后端 未结 12 1881
攒了一身酷
攒了一身酷 2020-12-07 08:45

I exported my database with JSON columns in it. After I migrated to a new server, my import crashed every time with an error like:

cannot create a JSO

12条回答
  •  猫巷女王i
    2020-12-07 09:20

    I faced the same issue today. Below were the findings for my case,

    I asked one of my friend to generate an SQL dump for me to import. He used sequel-pro to generate the dump (export database). When I did the import it threw an error

    Cannot create a JSON value from a string with CHARACTER SET 'binary'

    So, there was an issue with the generated dump, all the json fields were converted to some raw format i.e. instead of value being

    "{'key1':'value1', 'key2':'value2'}"

    it was,

    X'nfdsklsdsklnfjkbvkjsdbvkjhdfsbvkjdsbnvljkdsbvkjhdfbvkjdfbvjkdfb'

    So, when importing the dump i.e. running the insert statements mysql could not process the data as it was not of json type.

    Here is a link to the bug reported
    https://github.com/sequelpro/sequelpro/issues/2397

    You need to uncheck the Output BLOB fields as hex option.

提交回复
热议问题