473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Copying a table from one schema to another

Is it possible to copy a table from one schema to another schema by just
copying the frm file to the directory for the new schema?

What is the best way to create a new database with all the tables in it
automatically?

I was hoping to have the tables (the frm files) included in a subdirectory
and when required, just create a new schema then copy all the frm files into
it.

Any help greatly appreciated.

Tks
John
Jan 30 '06 #1
4 15392
"zMisc" <yo********@hotmail.com> wrote in message
news:_N*******************@news-server.bigpond.net.au...
Is it possible to copy a table from one schema to another schema by just
copying the frm file to the directory for the new schema?

What is the best way to create a new database with all the tables in it
automatically?

I was hoping to have the tables (the frm files) included in a subdirectory
and when required, just create a new schema then copy all the frm files into it.

Any help greatly appreciated.


I am going to *cautiously* suggest that you can simply create your new,
replicate, database by copying the entire database directory recursively to
a new directory in the mysql "data" directory. You want to replicate
*everything* - not just .frm files and you want to make sure MySQL retains
ownership of the new directory and all it's files.

In linux you can chdir to the mysql data directory and (as root!) issue the
cp (copy) command.
cp -p -R {OriginalDB} {ReplicateDB}

The [-p] switch preserves mysql file ownership and [-R] replicates the
*entire* database directory with all the files it contains.

This works neat as a pin in 4.0x and 4.1x versions of MySQL. I don't *know*
about version 5.0 or about MS Windows.

Thomas Bartkus


Jan 30 '06 #2
"zMisc" <yo********@hotmail.com> wrote in message
news:_N*******************@news-server.bigpond.net.au...
Is it possible to copy a table from one schema to another schema by just
copying the frm file to the directory for the new schema?


I never try to do database operations by manipulating the files at the
filesystem level.

I would do what you describe using mysqldump piped through mysql.

You can make mysqldump output skip the "create database" statement, and then
run the mysql tool with respect to a new, empty database (or any other
existing database). You can also make mysqldump back up selected tables
instead of a whole database. You can also make mysqldump back up table
schema only, without the contents of the tables if that is what you want.

There is enough flexibility to do what you want using proper tools, without
resorting to manipulating the myd and frm files.

Regards,
Bill K.
Jan 30 '06 #3
Hi Bill,

I can only see .frm files - there are no .myd files what are the myd files?

I am using MySQL 5.

Tks
"Bill Karwin" <bi**@karwin.com> wrote in message
news:dr*********@enews1.newsguy.com...
"zMisc" <yo********@hotmail.com> wrote in message
news:_N*******************@news-server.bigpond.net.au...
Is it possible to copy a table from one schema to another schema by just
copying the frm file to the directory for the new schema?


I never try to do database operations by manipulating the files at the
filesystem level.

I would do what you describe using mysqldump piped through mysql.

You can make mysqldump output skip the "create database" statement, and
then run the mysql tool with respect to a new, empty database (or any
other existing database). You can also make mysqldump back up selected
tables instead of a whole database. You can also make mysqldump back up
table schema only, without the contents of the tables if that is what you
want.

There is enough flexibility to do what you want using proper tools,
without resorting to manipulating the myd and frm files.

Regards,
Bill K.

Jan 31 '06 #4
>I can only see .frm files - there are no .myd files what are the myd files?

Files containing MyISAM table data.
I am using MySQL 5.


And probably InnoDB tables, so you won't have .MYD files.

Gordon L. Burditt
Jan 31 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: toedipper | last post by:
Hello, I am designing a table of vehicle types, nothing special, just a list of unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor etc etc For the table design I am...
4
by: Gordon Burditt | last post by:
What's the easiest way to copy a row from one table to another (with the same schema), without knowing in advance the number and types of the columns? The problem: I have several sets of tables...
6
by: Jeff Kowalczyk | last post by:
I need to adapt this an update statement to a general form that will iterate over multiple orderids for a given customerinvoiceid. My first concern is a form that will work for a given orderid,...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
7
by: Wayne Gibson | last post by:
Hi All, Was wondering if anybody could help. I'm currently trying to copy a record from datatable to another. I have two problems: 1) Transferring the record from one datatable to another. 2)...
3
by: NasirMunir | last post by:
The problem: I have two schemas in an oracle database. One of the schema is the updated one. I want to update the first schema table say table A with the updated table A of schema B. The first table...
2
by: NasirMunir | last post by:
is there a way of copying a table from one schema to another schema with oracle enterprise manager console? If not, how can I accomplish this Thanks
5
by: Dmitriy Lapko | last post by:
Hallo all Is it possible to change schema of table in DB2 v.8.2 without recreating and coping a table into a new schema? I need it for several purposes, one of them - refactoring of existing...
1
by: tshad | last post by:
Running on VS.net 2005, I am trying to copy rows from my datatable to another datatable in the same dataset. The schema would be identical. I need to make the table name "forms" as I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.