将.frm和.opt文件导入MySQL [英] Import .frm and .opt files to MySQL

查看:214
本文介绍了将.frm和.opt文件导入MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是从以下版本下载并安装的MySQL 5.5.1.1: http://dev.mysql.com/downloads /

I am using MySQL 5.5.1.1 downloaded and installed from : http://dev.mysql.com/downloads/

我要将.frm和.opt数据库文件从我的本地计算机导入我的mysql数据库。

I want to import .frm and .opt database files from my local machine to my mysql database.

我创建了一个新的数据库连接,以帮助我从我的机器导入文件。但我无法导入.frm文件,因为我不断收到错误消息:格式不支持。

I created a new Databbase connection to help me import the files from my machine. But I am unable to import .frm files as I keep getting error message: Format not supported.

有人可以帮助我如何导入文件到MySQL客户端? ?

Can someone please help me on how I could import files to MySQL client??

谢谢,
J

Thank you, J

推荐答案

远程导入任何MySQL数据,需要考虑三(3)个事情。

As far importing any MySQL data, three(3) things need to considered.

导入MyISAM表是一个简单的移动三个文件与扩展 .frm .MYD 。 MYI 文件导入MySQL文件夹。例如,如果表名称是mydata,那么三(3)个文件

Importing a MyISAM table is a simple as moving three files with the extensions .frm, .MYD, and .MYI files for the given table into a MySQL folder. For example, if the table name is mydata, then the three(3) files


  • mydata.frm

  • mydata.MYD

  • mydata .MYI

  • mydata.frm
  • mydata.MYD
  • mydata.MYI

以下可能是噩梦的噩梦。导入InnoDB完全取决于许多因素,分为两类:

The following could be the nightmare of nightmares. Importing InnoDB depends entirely on many factors that fall into one of two categories:

所有InnoDB数据和索引页位于 / var / lib / mysql / ibdata1 中。此文件必须从源计算机(Server-S)移动到目标计算机(Server-T),并放置在同一绝对路径中。实际上,这里是令人震惊的:Server-S和Server-T必须相同。换句话说,你不能导入和导出InnoDB .ibd 文件到其他机器。它们只能在同一台计算机上导入和导出 .ibd

All InnoDB data and index pages are located in /var/lib/mysql/ibdata1. This file must be moved from your source machine (Server-S) to the target machine (Server-T) and placed in the same absolute path. In fact, here is the shocker: Server-S and Server-T must be the same. In other words, you cannot import and export InnoDB .ibd files to other machines. They can only be imported and exported on the same machine the .ibd was created on.

从Server-S移动/ var / ib / mysql / ib_logfile0和/ var / ib / mysql / ib_logfile1,并将它们放在Server-T上的同一绝对路径中。

You would also have to move /var/ib/mysql/ib_logfile0 and /var/ib/mysql/ib_logfile1 from Server-S and place them in the same absolute path on Server-T.

您还必须确保在Server-S上的/etc/my.cnf中设置的每个InnoDB变量必须在Server-T上的/etc/my.cnf中设置。

You also must make sure that every InnoDB variable set in /etc/my.cnf from Server-S must be set in /etc/my.cnf on Server-T.

对于每个InnoDB表,将有两个文件。例如,如果mydata数据库中的InnoDB表称为mytable,您将有 /var/lib/mysql/mydata/mytable.frm 和/ var / lib / mysql /mydata/mytable.ibd。 .ibd 文件包含表的数据和索引页。要导入单个表格,您必须

For every InnoDB table, there will be two files. For example, if the InnoDB table in the mydata database is called mytable, you will have /var/lib/mysql/mydata/mytable.frm and /var/lib/mysql/mydata/mytable.ibd. The .ibd file contains data and index pages for the table. To import the individual table you must


  1. mytable.frm 放入 / var / lib / mysql / mydata folder on Server-T

  2. mytable.ibd / var / lib / mysql / mydata文件夹上Server-T

  3. 运行 ALTER TABLE mydata.mytable IMPORT TABLESPACE;

  1. Place the mytable.frm in /var/lib/mysql/mydata folder on Server-T
  2. Place the mytable.ibd in /var/lib/mysql/mydata folder on Server-T
  3. Run ALTER TABLE mydata.mytable IMPORT TABLESPACE;

确保您拥有 / var /

Make sure you have the /var/lib/mysql/ibdata1 in the same place it was imported from.

请不要在不同的服务器上使用IMPORT TABLESPACE技术。只是做一个mysqldump的一切,导入mysqldump。逻辑转储总是最安全的方式!

Please do not use IMPORT TABLESPACE techniques across different servers. Just do a mysqldump of everything and import the mysqldump. Logical dumps are always the safest way to go !!!

这篇关于将.frm和.opt文件导入MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆