GitLab数据库损坏了,如何恢复?

时间:2014-06-16 10:33:17

标签: gitlab

我的GitLab数据库(MySQL InnoDB)已损坏(我的硬盘出现问题),我的上一次备份是在从6.8升级到6.8.1期间执行的

现在我想再次使用GitLab,但如果我尝试使用

恢复它
/home/git/gitlab/$ bundle exec rake gitlab:backup:restore RAILS_ENV=production

我明白了:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

这是因为MySQL没有运行,但如果我尝试用service mysql start启动它就会失败,这就是日志:

140616  3:28:26 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future relea$140616  3:28:26 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
140616  3:28:26 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140616  3:28:26 InnoDB: The InnoDB memory heap is disabled
140616  3:28:26 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140616  3:28:26 InnoDB: Compressed tables use zlib 1.2.3.4
140616  3:28:26 InnoDB: Initializing buffer pool, size = 128.0M
140616  3:28:27 InnoDB: Completed initialization of buffer pool
140616  3:28:27  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

如何在不丢失上次提交的情况下恢复上次备份?

1 个答案:

答案 0 :(得分:0)

根据MySQL日志

  

140616 3:28:26 [错误]无法打开mysql.plugin表。请运行mysql_upgrade来创建它。

您必须运行IList<String> testCaseList = ExcelDataAccess.GetTestCases(); Parallel.ForEach(testCaseList, new ParallelOptions { MaxDegreeOfParallelism = 1 }, currentTestCase =>` { FileStream ostrm; StreamWriter writer; TextWriter oldOut = Console.Out; try { ostrm = new FileStream("C:\\Users\\Public\\Documents/Redirect" + currentTestCase +".txt", FileMode.OpenOrCreate, FileAccess.Write); writer = new StreamWriter(ostrm); } catch (Exception e) { Console.WriteLine("Cannot open Redirect.txt for writing"); Console.WriteLine(e.Message); return; } Console.SetOut(writer); Console.WriteLine("Running test: " + currentTestCase); //Do some other stuff and some Console.WriteLine(); } 命令来升级MySQL架构