SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do you get a dump of structure and content of an entire database?

    Can you get get a dump of structure and content of an entire database using SQL commands or do you have to go to the command prompt?

    I know this is a newbie question for most of you but any help is appreciated!

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    two available options are a web tool like phpmyadmin or the mysqldump tool from the command prompt.

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. Is there ANY WAY to do this from SQL command for the whole db or is it just on indivual tables?

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysqldump database

  5. #5
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    mysqldump is a command line tool that allows you to dump the contents to a file or to the shell.

    The command is used like:

    Code:
     mysqldump --add-drop-table -c -h host_name -p db_name > savefile.sql

  6. #6
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WebDevGuy
    thanks. Is there ANY WAY to do this from SQL command for the whole db or is it just on indivual tables?
    there is no SQL statement to export an entire database.

    think about this for a second. let's say for sake of argument that there was a way to export an entire DB using one SQL statement, like export * from table1, table2, how would mysql render the results if table 1 has 3 columns and 10 rows and table2 has 50 columns and 50 rows? should it be 3 columns, 50, or 53? if 53 columns, what do you do for the 40 rows where there is no data for table1? you can't have null,null,null because that type of record might have significance in the application.

  7. #7
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so, in phpMyAdmin, when you view the structure & data, it mysqldump's the info to a file then reads that file?

  8. #8
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    nope. it makes the file itself using the /libraries/export/sql.php file. but it looks just like the output of mysqldump.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •