Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2009
    Posts
    207
    Thanks
    27
    Thanked 0 Times in 0 Posts

    dropping database and replacing with backup

    my vbulletin forum was full of thousands of spam users and messages
    i decided to delete the current database and give it a fresh start from the backup

    do i delete the existing database and upload my backup database? or do i drop tables and upload everything from database backup? also can you write me the syntax for dropping and reloading?

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,944
    Thanks
    2
    Thanked 170 Times in 165 Posts
    The answer depends on the options used when creating the backup. If you did a standard dump, then the file should have "drop table if exists table" statements and you could do a standard restore without dropping the database.

    If you added new tables after making the backup dump and don't want them after the restore, then you'll need to drop the database then create the database only without tables and then do the standard restore.

    Syntax for a standard restore is:
    mysql -u user -p database < dump.sql

    How to Back Up and Restore a MySQL Database
    Last edited by FishMonger; 08-11-2013 at 06:10 PM. Reason: Added link to complete instructions


  •  

    Posting Permissions

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