Forum Moderators: coopster & phranque

Message Too Old, No Replies

mysqldump - How to Copy All Tables?

Without making a copy of the database

         

Nick_W

8:50 am on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

Is there a way to mysqldump all of the tables in a database?

I have to transfer a dozen or so tables but I can't control the name of the DB that they will be put into so can't just copy the entire db.

I can do it table by table but, is there a way to do it in one go?

Many thanks...

Nick

NameNick

9:36 am on May 9, 2003 (gmt 0)

10+ Year Member



Hi Nick,

You could use phpMyAdmin. The MySQL dump of a complete database only contains the code to create the tables. There is no connection/binding between the old database and the tables. Example:

#
# Table structure for table 'access'
#

CREATE TABLE access (

id int(10) NOT NULL auto_increment,
title varchar(20),
PRIMARY KEY (id)

);

Best

NN

Nick_W

9:39 am on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, don't have phpmyadmin though, just the command line...

Nick

mat

9:51 am on May 9, 2003 (gmt 0)

10+ Year Member



Do a search for Webyog - might do what you need.

NameNick

10:05 am on May 9, 2003 (gmt 0)

10+ Year Member



Hi Nick,

I have made MySQL dumps by console and by phpMyAdmin and in my experiences the dump structure is always the same[1]. The only connection to the old database is the 'create database' statement:

CREATE DATABASE /*!32312 IF NOT EXISTS*/ access;

And that statement can easy be changed.

[1] But I am willing to learn something new :)

NN

Nick_W

10:09 am on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cool! - Thanks for clarifying and thanks for all the help guys ;-)

Nick

Nick_W

10:37 am on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How odd...


mysqldump -p dbname > db.sql

provides exactly what I need without the create database stuff...

Thanks again..

Nick