Home > Software engineering >  ERROR: Encoding not recognized: 'undefined' when trying to Sequelize Mysql
ERROR: Encoding not recognized: 'undefined' when trying to Sequelize Mysql

Time:08-28

I'm trying to install and run Blocktogether on my Ubuntu server.

When I run ./node_modules/.bin/sequelize --config=config/sequelize.json db:migrate --env=production

I get this error:

Sequelize CLI [Node: 12.22.9, CLI: 5.5.1, ORM: 5.22.5]

Loaded configuration file "config/sequelize.json".

Using environment "production".

== 20160117144545-init: migrating =======

query: /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */

query:

/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */

query:

/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */

query:

/*!40101 SET NAMES utf8 */

query:

/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */

ERROR: Encoding not recognized: 'undefined' (searched as: 'undefined')

at Object.getCodec (/etc/blocktogether/node_modules/mysql2/node_modules/iconv-lite/lib/index.js:106:23)

at Object.getEncoder (/etc/blocktogether/node_modules/mysql2/node_modules/iconv-lite/lib/index.js:117:23)

at Object.exports.encode (/etc/blocktogether/node_modules/mysql2/lib/parsers/string.js:23:25) at Query.toPacket (/etc/blocktogether/node_modules/mysql2/lib/packets/query.js:16:30)

at Query.start (/etc/blocktogether/node_modules/mysql2/lib/commands/query.js:55:38)

at Query.execute (/etc/blocktogether/node_modules/mysql2/lib/commands/command.js:39:22)

at Connection.handlePacket (/etc/blocktogether/node_modules/mysql2/lib/connection.js:408:32)

at Connection.addCommand (/etc/blocktogether/node_modules/mysql2/lib/connection.js:430:12)

at Connection.query (/etc/blocktogether/node_modules/mysql2/lib/connection.js:493:17)

at /etc/blocktogether/node_modules/sequelize/lib/dialects/mysql/query.js:60:20

at Promise._execute (/etc/blocktogether/node_modules/bluebird/js/release/debuggability.js:384:9)

at Promise._resolveFromExecutor (/etc/blocktogether/node_modules/bluebird/js/release/promise.js:518:18)

at new Promise (/etc/blocktogether/node_modules/bluebird/js/release/promise.js:103:10)

at Query.run (/etc/blocktogether/node_modules/sequelize/lib/dialects/mysql/query.js:39:12)

at /etc/blocktogether/node_modules/sequelize/lib/sequelize.js:655:29

at tryCatcher (/etc/blocktogether/node_modules/bluebird/js/release/util.js:16:23)

at Promise._settlePromiseFromHandler (/etc/blocktogether/node_modules/bluebird/js/release/promise.js:547:31)

at Promise._settlePromise (/etc/blocktogether/node_modules/bluebird/js/release/promise.js:604:18)

at Promise._settlePromise0 (/etc/blocktogether/node_modules/bluebird/js/release/promise.js:649:10)

at Promise._settlePromises (/etc/blocktogether/node_modules/bluebird/js/release/promise.js:729:18)

at _drainQueueStep (/etc/blocktogether/node_modules/bluebird/js/release/async.js:93:12)

at _drainQueue (/etc/blocktogether/node_modules/bluebird/js/release/async.js:86:9)

My sequelize.json contains these lines:

{
   "development": {
     "username": "root",
     "password": "Password",
     "database": "Twitter",
     "host": "127.0.0.1",
     "dialect": "mysql"
   },
   "production": {
     "username": "root",
     "password": "Password",
     "database": "Twitter",
     "host": "127.0.0.1",
     "dialect": "mysql"
 
   }
 }

Would you please help me with this error?

CodePudding user response:

I got this solved by removing all lines starting with /*!40.. in my sql files.

  • Related