前幾天向公司申請了一臺新電腦mysql數據庫文件恢復,這兩天新電腦到了,就是各種軟件的安裝,工作環境的搭建mysql數據庫文件恢復,其中有一項就是把之前的Mysql數據移到新電腦上來。
由于換了新電腦后,是把原來的硬盤直接拿過來放在新電腦中使用的,所以所有數據都可以在新電腦中直接訪問。
下面直接說相應的步驟:
1.安裝好Mysql
2.停止Mysql服務
3.直接把原Mysql實例所在的數據庫目錄復制到新實例所在的數據庫目錄。Mysql默認情況下的數據庫目錄在C:\\MySQL\MySQL X.Y\data其中的X.Y為Mysql的版本號。
4.把原來的Mysql配置文件(一般默認為my.ini)也復制到新的實例中作為配置,不然可能會出現無法啟動Mysql服務的情況。
211227 10:33:22 [Note] Plugin 'FEDERATED' is disabled.

211227 10:33:22 InnoDB: The InnoDB memory heap is disabled
211227 10:33:22 InnoDB: Mutexes and rw_locks use Windows interlocked functions
211227 10:33:22 InnoDB: Compressed tables use zlib 1.2.3

211227 10:33:22 InnoDB: Initializing buffer pool, size = 47.0M
211227 10:33:22 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file .\ib_logfile0 is of different size 0 56623104 bytes

InnoDB: than specified in the .cnf file 0 25165824 bytes!
211227 10:33:22 [ERROR] Plugin 'InnoDB' init function returned error.
211227 10:33:22 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

211227 10:33:22 [ERROR] Unknown/unsupported storage engine: INNODB
211227 10:33:22 [ERROR] Aborting
5.啟動Mysql服務
注意:筆者是在同樣的Mysql版本中操作的,不同的Mysql版本可能會出現問題。