Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:56:05+00:00 2026-06-05T05:56:05+00:00

Im trying to rake db:schema:load but I get the error Mysql2::Error: Specified key was

  • 0

Im trying to rake db:schema:load but I get the error

Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX 

From what I understand is that InnoDB only allows a max of 767 bytes in their index… And if you’re using utf-8 it should be divided by 3.

But when i try to set a maximum of 100 characters (its not even close to 767) in the schema.rb the error still occurs…

schema.rb

add_index "friendly_id_slugs", ["slug", "sluggable_type"], :name => "index_friendly_id_slugs_on_slug_and_sluggable_type", :unique => true, :length => { :name => 100, :slug => 100, :sluggable_type => 40 }

Error

-- add_index("friendly_id_slugs", ["slug", "sluggable_type"], {:name=>"index_friendly_id_slugs_on_slug_and_sluggable_type", :unique=>true, :length=>{:name=>100, :slug=>100, :sluggable_type=>40}})
rake aborted!
Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX `index_friendly_id_slugs_on_slug_and_sluggable_type` ON `friendly_id_slugs` (`slug`, `sluggable_type`)

MySQL

Your MySQL connection id is 1838
Server version: 5.5.22-0ubuntu1-log (Ubuntu)

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:56:07+00:00Added an answer on June 5, 2026 at 5:56 am

    I see two problems in your code:

    • The limit parameter should be called length
    • On multi-column indexes the length parameter should be a hash that specifies the length for both columns: :length => { :slug => 200, :sluggable_type => 30 }

    Check out the documentation: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_index-label-Creating+an+index+with+specific+key+length.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do a rake migrate, but I'm getting an error when I
I get this error trying to run any Ultrasphinx rake commands (under Linux terminal)
Trying to update the production mysql database by doing: rvmsudo RAILS_ENV=production rake db:schema:load on
I am trying to use CSV fixtures, but when I do rake db:fixtures:load ,
I'm trying to get a compile command (rake cucumber) to run with a specific
When I'm trying to seed my database, I started getting this error: rake aborted!
this might be rather unspecific, but I'm trying to do 'rake test' on a
I am trying to get my rails app to production but this is my
I have been trying to run rake but it seems that ever since I
I'm trying to deploy a Rails3 app to Heroku, but am getting this 'Rake

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.