Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动报错 #184

Open
qiaoqiwei123 opened this issue Aug 5, 2024 · 4 comments
Open

启动报错 #184

qiaoqiwei123 opened this issue Aug 5, 2024 · 4 comments

Comments

@qiaoqiwei123
Copy link

为什么我pnpm dev启动midwa的时候老是出现报错
微信图片_20240805220552
微信图片_20240805220611

@rysly
Copy link

rysly commented Aug 6, 2024

我也遇到同样的问题,请问怎么解决?我的node是16,18,20都试过了,都不行

@qiaoqiwei123
Copy link
Author

我也遇到同样的问题,请问怎么解决?我的node是16,18,20都试过了,都不行

你的也是pnpm dev的时候显示数据库连接错误??

@Leeiio
Copy link

Leeiio commented Aug 16, 2024

这是数据库问题,Specified key was too long; max key length is 767 bytes 搜索一下

@svenjia
Copy link

svenjia commented Aug 24, 2024

这是因为mysql 不同版本 InnoDB 对于varchar列的索引长度的限制不同。MySQL 5.7.8之前是767bytes ,5.7.9及以上是3072bytes,
数据库字符集用的utf8mb4,每个字符最大占用4byte,那么varchat长度,5.7.8应该设为767/4 = 191,如果用字符集是utf8,则是767 / 3 = 255;
所以,要么升级mysql版本,要么改列的最大长度是191,要么字符集用utf8;
参考:

  1. stackoverflow
  2. mysql文档1
  3. mysql文档2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants