Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #2412

Closed
Open
Created Dec 28, 2012 by Administrator@rootOwner

Mysql2::Error: Specified key was too long; max key length is 1000 bytes

Created by: daald

I got the following error while running sudo -u gitlab -H bundle exec rake gitlab:app:setup RAILS_ENV=production (command from https://github.com/gitlabhq/gitlabhq/blob/stable/doc/install/installation.md, installation uses mysql 5.1.66-0+squeeze1):

rake aborted!
Mysql2::Error: Specified key was too long; max key length is 1000 bytes: CREATE UNIQUE INDEX `index_users_on_extern_uid_and_provider` ON `users` (`extern_uid`, `provider`)
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `block in execute'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql2_adapter.rb:211:in `execute'
/home/gitlab/gitlab/config/initializers/connection_fix.rb:22:in `execute'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/schema_statements.rb:352:in `add_index'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:466:in `block in method_missing'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in `block in say_with_time'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in `say_with_time'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:458:in `method_missing'
/home/gitlab/gitlab/db/schema.rb:249:in `block in <top (required)>'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/schema.rb:50:in `instance_eval'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/schema.rb:50:in `define'
/home/gitlab/gitlab/db/schema.rb:14:in `<top (required)>'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in `load'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in `block in load'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in `load'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:388:in `block (3 levels) in <top (required)>'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:395:in `block (3 levels) in <top (required)>'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)
root@gitlab:/home/gitlab/gitlab# echo $?
1

The following changes did the trick:

diff -u db/schema.rb- db/schema.rb
--- db/schema.rb-   2012-12-27 23:45:42.732086708 +0000
+++ db/schema.rb    2012-12-28 00:18:36.037284926 +0000
@@ -205,8 +205,8 @@
     t.datetime "created_at"
   end

-  add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
-  add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
+  #add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
+  #add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"

   create_table "tags", :force => true do |t|
     t.string "name"
@@ -246,7 +246,7 @@
   add_index "users", ["admin"], :name => "index_users_on_admin"
   add_index "users", ["blocked"], :name => "index_users_on_blocked"
   add_index "users", ["email"], :name => "index_users_on_email", :unique => true
-  add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true
+  #add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true
   add_index "users", ["name"], :name => "index_users_on_name"
   add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
   add_index "users", ["username"], :name => "index_users_on_username"
Assignee
Assign to
Time tracking