第一步 关闭服务
/etc/init.d/gitlab stop
第二部 创建MYSQL用户和数据库
create database gitlab;
grant all privileges on gitlab.* to "gitlab" identified by "gitlab";
flush privileges;
导出数据
cd /home/gitlab/gitlab
bundle exec rake db:data:dump RAILS_ENV=production
第三步 修改数据库配置文件
cd /home/gitlab/gitlab
mv config/database.yml config/database.yml.old
cp config/database.yml.example config/database.yml
编辑改文件修改MYSQL密码
vi config/database.yml
其中password: "secure password"改为password: "密码"
第四步 恢复数据
cd /home/gitlab/gitlab
bundle exec rake db:setup RAILS_ENV=production
bundle exec rake db:data:load RAILS_ENV=production
第五步 启动服务
/etc/init.d/gitlab start
本文转自 ppabc 51CTO博客,原文链接:http://blog.51cto.com/ppabc/999732