SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2000
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi. I am using PHP and MySQL and was wondering how to copy a database and recreate it with another name? I would like to duplicate my site, but on the new site I would like to be able modify the database from the original table.

    Is this possible?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can use mysqldump to save your original dataabse then CREATE a new database and import the data in from the mysqldump file. If you have telnet access to your server it would go something like this

    mysqldump -u username -p olddatabasename > olddatabasenamedump.sql

    CREATE a new database

    then use

    mysql -u username -p newdatabasename < databasenamedump.sql
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Alternatively, you can shut down the server and just copy the entire directory in the server's data directory. Each database is simply a directory containing a number of files, and renaming/copying those directories is the same as renaming/copying the databases. Just be sure to have your server shut down before you do something like this.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


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
  •