请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

代码部署到阿里云ecs, 出现错误,请问怎么解决?

node sync.js

Executing (default): SELECT 1+1 AS result
Executing (default): DROP TABLE IF EXISTS atRelations;
auth ok
Executing (default): DROP TABLE IF EXISTS userRelations;
Executing (default): DROP TABLE IF EXISTS blogs;
Executing (default): DROP TABLE IF EXISTS users;
Executing (default): DROP TABLE IF EXISTS users;
Executing (default): CREATE TABLE IF NOT EXISTS users (id INTEGER NOT NULL auto_increment , userName VARCHAR(255) NOT NULL UNIQUE COMMENT ‘用户名,唯一’, password VARCHAR(255) NOT NULL COMMENT ‘密码’, nickName VARCHAR(255) NOT NULL COMMENT ‘昵称’, gender DECIMAL NOT NULL DEFAULT 3 COMMENT ‘性别(1 男性,2 女性,3 保密)’, picture VARCHAR(255) COMMENT ‘头像,图片地址’, city VARCHAR(255) COMMENT ‘城市’, createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
Unhandled rejection SequelizeDatabaseError: Specified key was too long; max key length is 767 bytes
at Query.formatError (/www/wwwroot/koa2-weibo/node_modules/sequelize/lib/dialects/mysql/query.js:244:16)
at Query.handler [as onResult] (/www/wwwroot/koa2-weibo/node_modules/sequelize/lib/dialects/mysql/query.js:51:23)
at Query.execute (/www/wwwroot/koa2-weibo/node_modules/mysql2/lib/commands/command.js:30:14)
at Connection.handlePacket (/www/wwwroot/koa2-weibo/node_modules/mysql2/lib/connection.js:408:32)
at PacketParser.onPacket (/www/wwwroot/koa2-weibo/node_modules/mysql2/lib/connection.js:70:12)
at PacketParser.executeStart (/www/wwwroot/koa2-weibo/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket. (/www/wwwroot/koa2-weibo/node_modules/mysql2/lib/connection.js:77:25)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

正在回答 回答被采纳积分+3

1回答

双越 2022-02-09 07:54:13

数据库是哪里的?本机的,还是远程的

0 回复 有任何疑惑可以回复我~
  • 提问者 慕仔9117169 #1
    阿里云ecs mysql, 代码我已经部署在阿里云服务器上,运行代码出错了
    回复 有任何疑惑可以回复我~ 2022-02-09 09:50:30
  • 双越 回复 提问者 慕仔9117169 #2
    我也一眼看不出哪里的问题。解决这样问题的通用套路:做一个最简单的 demo ,就一个表,然后部署到阿里云,看能否运行成功。如果运行能成功,再慢慢增加表,慢慢的调试,就能找到问题。
    回复 有任何疑惑可以回复我~ 2022-02-09 14:31:54
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信