Drop table ...?

Discussion in 'MySQL' started by JEP_Dude, Jul 17, 2011.

  1. #1
    Hey there....

    How can I, in just one line, drop all the tables from a database, without erasing the DB? Would either of these work?

    DROP TABLE *
    or
    DROP ALL TABLES

    How can this be done?

    May you have a blessed day as the LORD wills.

    JEP_Dude
     
    JEP_Dude, Jul 17, 2011 IP
  2. srikanth03565

    srikanth03565 Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    you can use following command and you can also try this with sed

    here test-dbname
    root-username
    root-password

    mysqldump -uroot -proot --no-data --add-drop-table test |grep ^DROP | mysql -uroot -proot tes
     
    srikanth03565, Jul 18, 2011 IP
  3. JEP_Dude

    JEP_Dude Peon

    Messages:
    121
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    THANK YOU ....

    However, what I've found online clearly states that this is an impossible task. Yet, many of the comments that gave me answer were from those pondering this issue just after 2000.

    So, if what you say is true and they were true (from their time period), then I must ask you (and anyone else who knows) what version of SQL has made this possible? Was it added to SQL Server 2005 or was it new with 2008?

    Thanks for your skillful insight! I will let you know if attempts are successful.

    May you have a blessed day as Thee LORD wills.

    JEP_Dude
     
    JEP_Dude, Jul 18, 2011 IP