导入旧的 mysql 数据文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2845015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importing old mysql data folder
提问by SamGoody
After a reinstall, all of the old data still shows inside the MySQL/data folder, but is not actually loaded into the database.
重新安装后,所有旧数据仍显示在 MySQL/data 文件夹中,但实际上并未加载到数据库中。
Is there any way to have MySQL scan it's data folder and / or reimport the old folders it has from its previous install?
有什么方法可以让 MySQL 扫描它的数据文件夹和/或重新导入它以前安装的旧文件夹?
[Some data was changed after the last backup / export - partially my fault - so I would rather it recognize the folders rather than reimporting the SQL files.]
[在上次备份/导出后更改了一些数据 - 部分是我的错 - 所以我宁愿它识别文件夹而不是重新导入 SQL 文件。]
回答by Andy
If the data is in the correct folder, it will be visible in MySQL, or you will get errors when the server starts. Check /var/log/messages
and your MySQL error log (as defined in your config).
如果数据在正确的文件夹中,它将在 MySQL 中可见,否则您将在服务器启动时出错。检查/var/log/messages
您的 MySQL 错误日志(如您的配置中所定义)。
If you don't get any errors and can't see the data, it's likely that the data path in my.cnf
is pointing to a different folder.
如果您没有收到任何错误并且看不到数据,则很可能是数据路径my.cnf
指向了不同的文件夹。
回答by Datadimension
The above are good ideas. To recover backup from an existing backup directory with zero effect on any existing database:
以上是好主意。要从现有备份目录恢复备份,而对任何现有数据库的影响为零:
- change my.cnf / my.ini to your backup folder (if you don't have OUCH - do it in the future !!!)
- restart MySQL service
- 将 my.cnf / my.ini 更改为您的备份文件夹(如果您没有 OUCH - 以后再做!!!)
- 重启 MySQL 服务
You are now running from your backup, so do a MySQL dump for data tables you need
您现在正在从备份中运行,因此请为您需要的数据表执行 MySQL 转储
- change my.cnf / my.ini to your active folder
- restart MySQL service
- import your dumped MySQL
- 将 my.cnf / my.ini 更改为您的活动文件夹
- 重启 MySQL 服务
- 导入您转储的 MySQL