同时拷贝innodb数据库表“*.frm”文件和innodb数据“ibdata1”文件到合适的位置。启动MySQL的Windows服 务,如果不能成功的话,查看data文件夹中有个“*.err”错误日志文件,其中会对启动失败的原因有所描述的。比如我碰到过两种错误原因。
一种是类似这样的错误信息:
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> InnoDB: Error: log file .\ib_logfile0 is of different size 0 10485760 bytes InnoDB: than specified in the .cnf file 0 25165824 bytes!
这是因为在mysql配置文件中配置的日志文件大小与实际的不相符。
解决方法是直接删掉旧的“ib_logfile0”等日志文件,重启MySQL后会自动生成新的日志文件的。
另一中则是这样的错误信息
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> InnoDB: Operating system error number 5 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. It may also be you have created a subdirectory InnoDB: of the same name as a data file. InnoDB: File name .\ibdata1 InnoDB: File operation call: 'open'. InnoDB: Cannot continue operation.
经检查原来是“ibdata1”文件在复制的过程中不知怎的被加上只读属性了。
解决方法是去掉“ibdata1”文件的只读属性便可。