Gitlab 500报错解决

今天搭建了Gitlab项目启动后用浏览器访问显示500报错 500是内部错误

解决方法:首先查看gitlab日志

查看错误日志

cat /home/git/gitlab/log/production.log

ActiveRecord::StatementInvalid (Mysql2::Error: Table ‘gitlabhq_production.projects’ doesn’t exist: SHOW FULL FIELDS FROM projects):
  config/initializers/connection_fix.rb:20:in execute'
  app/controllers/application_controller.rb:196:in
add_gon_variables’
Mysql2::Error: Table ‘gitlabhq_production.projects’ doesn’t exist: SHOW FULL FIELDS FROM projects
Completed 500 Internal Server Error in 15ms (ActiveRecord: 5.0ms)
ActiveRecord::StatementInvalid (Mysql2::Error: Table ‘gitlabhq_production.projects’ doesn’t exist: SHOW FULL FIELDS FROM projects):
  config/initializers/connection_fix.rb:20:in execute'
  app/controllers/application_controller.rb:196:in
add_gon_variables

可以看到日志里面是数据库报错

应该是初始化数据库并激活高级功能那一步哪里没有设定好Mysql的连接

bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=123456

GITLAB_ROOT_PASSWORD 值为管理员 root 登录密码本例设为123456

再次重启Gitlab就可以访问了

/etc/init.d/gitlab restart

成功解决!

 

 

 

 

欢迎留言