By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

Need script to copy a database and all it's tables

P: n/a
Hi,

My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.

Can you help please ?

Jul 10 '07 #1
Share this Question
Share on Google+
12 Replies


P: n/a
On 10 Jul, 10:12, Robbo <i...@fds7.comwrote:
Hi,

My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.

Can you help please ?
Use the export option of phpmyadmin.

Also see the newsgroup
alt.possessive.its.has.no.apostrophe
for information on the correct use of an apostrophe in the word "its"!

Jul 10 '07 #2

P: n/a
On 10 Jul, 10:32, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 10 Jul, 10:12, Robbo <i...@fds7.comwrote:
Hi,
My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.
Can you help please ?

Use the export option of phpmyadmin.

Also see the newsgroup
alt.possessive.its.has.no.apostrophe
for information on the correct use of an apostrophe in the word "its"!
That is assuming of course that you are using mysql, since you haven't
said what database you are indeed using!

Jul 10 '07 #3

P: n/a
On 10.07.2007 11:12 Robbo wrote:
Hi,

My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.

Can you help please ?
If your database is Mysql, there are command-line tools mysqldump (for
export) and mysql (for import). You can also simply copy the db directory.
--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jul 10 '07 #4

P: n/a
On 10 Jul, 11:26, gosha bine <stereof...@gmail.comwrote:
On 10.07.2007 11:12 Robbo wrote:
Hi,
My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.
Can you help please ?

If your database is Mysql, there are command-line tools mysqldump (for
export) and mysql (for import). You can also simply copy the db directory.

--
gosha bine

extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
| You can also simply copy the db directory.

Bad advice! May not work between MySQL versions.

Jul 10 '07 #5

P: n/a
Captain Paralytic wrote:
Also see the newsgroup
alt.possessive.its.has.no.apostrophe
for information on the correct use of an apostrophe in the word "its"!
Read it and its very interesting.

houghi
--
You can have my keyboard ...
if you can pry it from my dead, cold, stiff fingers
Jul 10 '07 #6

P: n/a
On 10.07.2007 12:45 Captain Paralytic wrote:
On 10 Jul, 11:26, gosha bine <stereof...@gmail.comwrote:
>On 10.07.2007 11:12 Robbo wrote:
>>Hi,
My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.
Can you help please ?
If your database is Mysql, there are command-line tools mysqldump (for
export) and mysql (for import). You can also simply copy the db directory.

--
gosha bine

extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok

| You can also simply copy the db directory.

Bad advice! May not work between MySQL versions.
Let OP decide if that works for him/her.
--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jul 10 '07 #7

P: n/a
On 10 Jul, 12:06, gosha bine <stereof...@gmail.comwrote:
On 10.07.2007 12:45 Captain Paralytic wrote:


On 10 Jul, 11:26, gosha bine <stereof...@gmail.comwrote:
On 10.07.2007 11:12 Robbo wrote:
>Hi,
My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.
Can you help please ?
If your database is Mysql, there are command-line tools mysqldump (for
export) and mysql (for import). You can also simply copy the db directory.
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
| You can also simply copy the db directory.
Bad advice! May not work between MySQL versions.

Let OP decide if that works for him/her.

--
gosha bine

extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok- Hide quoted text -

- Show quoted text -
| Let OP decide if that works for him/her.

He/She can decide now that they are warned!

Jul 10 '07 #8

P: n/a
Captain Paralytic wrote:
On 10 Jul, 11:26, gosha bine <stereof...@gmail.comwrote:
>On 10.07.2007 11:12 Robbo wrote:
>>Hi,
My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.
Can you help please ?
If your database is Mysql, there are command-line tools mysqldump (for
export) and mysql (for import). You can also simply copy the db directory.

--
gosha bine

extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok

| You can also simply copy the db directory.

Bad advice! May not work between MySQL versions.
It also can cause inconsistent results of MySQL is running at the time,
and generally will not work for INNODB tables.

I agree - a very bad suggestion! Rather, Export/Import or Backup/Restore.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 10 '07 #9

P: n/a
On 10.07.2007 13:41 Jerry Stuckle wrote:
>>
| You can also simply copy the db directory.

Bad advice! May not work between MySQL versions.

It also can cause inconsistent results of MySQL is running at the time,
and generally will not work for INNODB tables.
Yes, like most technical suggestions/advices it may or may not work
under some specific conditions. I just pointed out that such a
possibility exists.

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jul 10 '07 #10

P: n/a
Thanks for all your input. Perhaps I should have been more specific in
the question -

I need re-useable php code to get the structure of a MySql database
and it's tables then to create a new EMPTY MySql database with the
same structure.

All help appreciated

Jul 10 '07 #11

P: n/a
Robbo wrote:
Thanks for all your input. Perhaps I should have been more specific in
the question -

I need re-useable php code to get the structure of a MySql database
and it's tables then to create a new EMPTY MySql database with the
same structure.

All help appreciated
Robbo,

OK, that's a different story.

You're probably better off using the MySQL calls to get your information
- such as SHOW TABLES to get the table list, SHOW CREATE TABLES to get
the CREATE TABLE statement used, etc.

You can go to comp.databases.mysql for the MySQL statements you need.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 10 '07 #12

P: n/a
..oO(Robbo)
>My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.
The fastest way is to do it on the command line.

Export:
mysqldump -uUsername -p -d Database tables.sql

Import:
mysql -uUsername -p Database < tables.sql

Replace Username and Database accordingly.

Micha
Jul 10 '07 #13

This discussion thread is closed

Replies have been disabled for this discussion.