第一步 關閉服務git
/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