How to copy database in mysql or create a backup? RRS feed

  • Question

  • Hi friends,

    I want to copy of one database into another database within same server. and I am using mysql database

    • Edited by Banku Tuesday, August 13, 2013 5:16 AM
    Tuesday, August 13, 2013 5:05 AM

All replies

  • This is not the correct Forum for asking questions on Database and Database Servers please got following forum ""

    Thanks !!!

    Sachin Vashishth MCTS

    Tuesday, August 13, 2013 7:01 AM
  • Hi... Anyways

    In mysql

    To copying a table from one database to another

    CREATE TABLE db2.table LIKE db1.table; 
    INSERT INTO db2.table SELECT * FROM db1.table; 

    Subqueries not required.

    1. Backup a single database:

    This example takes a backup of sugarcrm database and dumps the output to sugarcrm.sql

    # mysqldump -u root -ptmppassword sugarcrm > sugarcrm.sql # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

    The sugarcrm.sql will contain drop table, create table and insert command for all the tables in the sugarcrm database.

     Backup all the databases:

    The following example takes a backup of  all the database of the MySQL instance.

    # mysqldump -u root -ptmppassword --all-databases > /tmp/all-database.sql


    Ajith -V -K

    Tuesday, August 13, 2013 7:23 AM
  • Thank you ajit
    Tuesday, August 13, 2013 8:07 AM