MySQL很强大,支持直接拷贝数据库文件快速备份,那数据库文件在哪里呢?
打开MySQL的配置文件 my.ini,找到 datadir 节点,如
datadir="D:/Program Files/MySQL/MySQL Server 5.1/data"进入上述文件夹,就可以看到MySQL中新建的数据库文件夹了,每个文件夹以数据库名命名的,你想备份哪个数据库,把这个文件夹拷贝走即可。到时还原数据库,把它拷贝到data目录下即可,就这么简单!
但是,今天在一台MySQL服务器上拷贝备份了一个数据库后,在另外一台服务器上还原后,重启MySQL服务,通过使用 navicate for mysql 工具查看数据库 “xxx database”中某张表,结果显示“mysql table 'xxx table' doesn`t exist”。
查看了下MySQL的data文件加下的文件,发现了WIN-4FA0WLP5F0V.err和WIN-4FA0WLP5F0V.pid两个文件,于是看了具体的错误内容如下:
120622 12:00:36 [Note] Plugin 'FEDERATED' is disabled.120622 12:00:37 InnoDB: Initializing buffer pool, size = 300.0M120622 12:00:37 InnoDB: Completed initialization of buffer poolInnoDB: The first specified data file .\ibdata1 did not exist:InnoDB: a new database to be created!120622 12:00:37 InnoDB: Setting file .\ibdata1 size to 10 MBInnoDB: Database physically writes the file full: wait...120622 12:00:37 InnoDB: Log file .\ib_logfile0 did not exist: new to be createdInnoDB: Setting log file .\ib_logfile0 size to 60 MBInnoDB: Database physically writes the file full: wait...120622 12:00:37 InnoDB: Log file .\ib_logfile1 did not exist: new to be createdInnoDB: Setting log file .\ib_logfile1 size to 60 MBInnoDB: Database physically writes the file full: wait...InnoDB: Doublewrite buffer not found: creating newInnoDB: Doublewrite buffer createdInnoDB: Creating foreign key constraint system tablesInnoDB: Foreign key constraint system tables created120622 12:00:39 InnoDB: Started; log sequence number 0 0120622 12:00:39 [Note] Event Scheduler: Loaded 0 events120622 12:00:39 [Note] D:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: ready for connections.Version: '5.1.55-community' socket: '' port: 3306 MySQL Community Server (GPL)120622 12:02:49 [ERROR] Cannot find or open table magento/catalog_product_bundle_selection_price fromthe internal data dictionary of InnoDB though the .frm file for thetable exists. Maybe you have deleted and recreated InnoDB datafiles but have forgotten to delete the corresponding .frm filesof InnoDB tables, or you have moved .frm files to another database?or, the table contains indexes that this version of the enginedoesn't support.See http://dev.mysql.com/doc/refman/ ... bleshooting.htmlhow you can resolve the problem.感觉应该是数据库引擎配置的问题,于是搜索了有关InnoDB 和MyISAM的相关资料,如下这段内容很有意义: