I am using MySQL 5.5.1.1 downloaded and installed from : http://dev.mysql.com/downloads/
I want to import .frm and .opt database files from my local machine to my my
I did a mysql import using the files on xampp. I have very many databases so I did not want to go through the mysqldump route. The process was:
At the end of the process I had mysql working perfectly with all my databases and users intact.
I think the great problem you may be experiencing comes from the fact that you cannot even view these .frm files in the phpmyadmin interface (because they really are incomplete sets). I'd suggest you delete these files from the current location and use phpmyadmin to re-create the these tables as SQL under "query" tab [delete IFF you do have database script of everything. if not, you may still get this from the old dump. if not gaian, do NOT delete). Thanks : chagbert.
As far importing any MySQL data, three(3) things need to considered.
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
The following could be the nightmare of nightmares. Importing InnoDB depends entirely on many factors that fall into one of two categories:
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.
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.
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.
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
mytable.frm
in /var/lib/mysql/mydata folder
on Server-Tmytable.ibd
in /var/lib/mysql/mydata folder
on Server-TALTER TABLE mydata.mytable IMPORT TABLESPACE;
Make sure you have the /var/lib/mysql/ibdata1
in the same place it was imported from.
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 !!!
Just copy desired 'data' folder to target mysql data folder, after renaming current 'data' folder, after stop mysql service. And export to sql file with phpmyadmin, and restore current data folder, and import desired data sql.