新手问题 Mysql2::Error: Specified key was too long; max key length is 767 bytes

fengfans · May 22, 2013 · Last by fengfans replied at May 22, 2013 · 5666 hits
fengfans@fengfans-PC:~/codes/rails-project/GoodRead$ rake db:migrate
(in /home/fengfans/codes/rails-project/GoodRead)
==  DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
   -> 0.1092s
-- add_index(:users, :email, {:unique=>true, :limit=>5})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX `index_users_on_email` ON `users` (`email`)

(See full trace by running task with --trace)
fengfans@fengfans-PC:~/codes/rails-project/GoodRead$ 

请各位高手指点小弟!

不好意思,小弟自己的错误,字符集设置错了,设置成 utf8mb4 的了。改成 utf8 的就 OK 了。打扰大家了。

You need to Sign in before reply, if you don't have an account, please Sign up first.