Issue after updating to 3.1.7 with UNKNOWN_CHARACTER_SET

Hello, I get this issue since upgrading, and trying to run with npm run develop gives this output:

[2020-10-03T09:20:39.629Z] debug ⛔️ Server wasn't able to start properly.
[2020-10-03T09:20:39.630Z] error Error: ER_UNKNOWN_CHARACTER_SET: Unknown character set: 'utf8mb4_unicode_ci'
    at Query.Sequence._packetToError (/var/www/api.something.gg/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Query.ErrorPacket (/var/www/api.something.gg/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
    at Protocol._parsePacket (/var/www/api.something.gg/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/var/www/api.something.gg/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/var/www/api.something.gg/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/var/www/api.something.gg/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/var/www/api.something.gg/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/var/www/api.something.gg/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
    at Protocol._enqueue (/var/www/api.something.gg/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Connection.query (/var/www/api.something.gg/node_modules/mysql/lib/Connection.js:198:25)
    at /var/www/api.something.gg/node_modules/knex/lib/dialects/mysql/index.js:130:18
From previous event:
    at Client_MySQL._query (/var/www/api.something.gg/node_modules/knex/lib/dialects/mysql/index.js:124:12)
    at Client_MySQL.query (/var/www/api.something.gg/node_modules/knex/lib/client.js:158:17)
    at Runner.query (/var/www/api.something.gg/node_modules/knex/lib/runner.js:135:36)
    at Runner.queryArray (/var/www/api.something.gg/node_modules/knex/lib/runner.js:224:14)
    at /var/www/api.something.gg/node_modules/knex/lib/runner.js:37:25
From previous event:
    at Runner.run (/var/www/api.something.gg/node_modules/knex/lib/runner.js:25:16)
    at SchemaBuilder.Target.then (/var/www/api.something.gg/node_modules/knex/lib/interface.js:14:43)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-something@0.1.0 develop: `strapi develop`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the strapi-something@0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/username/.npm/_logs/2020-10-03T09_20_39_657Z-debug.log

My uneducated guess is that some data type has changed perhaps and now my DB isn’t compatible, but I couldn’t see any mention of this in the migration guide- maybe I didn’t look hard enough though.

Here is my db config file

module.exports = ({ env }) => ({
  defaultConnection: 'default',
  connections: {
    default: {
      connector: 'bookshelf',
      settings: {
        client: "mysql",
        host: "localhost",
        port: 3306,
        username: "x",
        password: "x",
        database: "comp_prim",
        charset: "utf8mb4_unicode_ci",
      },
      options: {
        charset: "utf8mb4_unicode_ci",
        pool: {
          max: 5
        }
      }
    },
  },
});

Thanks!

Those charset settings don’t look quite right, but those settings are passed onto Knex/MySQL packages and it’s not really a Strapi thing. For some reason though either the mysql package or your actual MySQL server don’t recognize that charset.

Hmm fair enough- would you have any suggestions on what to try?

My old data doesn’t really matter in fairness, so I could get a new DB going perhaps.

Yeah I would say new db then and try to stick with a common charset like just utf8

Cool, when you said something about my db config seemed wrong, was it just the charset? :slight_smile:

Yeah I had never seen that charset, it is valid though, I had to double check :laughing:

I’m used to seeing the charset name not the collation name IE:

  • Charset: utf8mb4
  • Collation: utf8mb4_general_ci