Announcement

Collapse
No announcement yet.

How do you COMPLETELY empty an SQL database via SSH?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Computer Chat How do you COMPLETELY empty an SQL database via SSH?

    Anyone know? I could really do with the help.

    Thanks...
    "CREEPSHOW CREEPS ONLINE" - The first & best online resource dead-icated to Stephen King & George A. Romero's 1982 horror anthology classic!!!!

  • #2
    Why don't you just delete it or drop it [SSH], and recreate it?
    MCSE, MVP, CCIE
    Microsoft Beta Team

    Comment


    • #3
      $ mysql
      > select database databasename;
      > show tables;
      > drop table1;
      > drop table2;
      > drop table3;
      > drop table4;
      > drop table5;

      I think that's it more or less...
      Radio and TV Player for vBulletin

      Comment


      • #4
        DROP DATABASE dbname.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API - Full / Mobile
        Vote for your favorite feature requests and the bugs you want to see fixed.

        Comment


        • #5
          Originally posted by Wayne Luke View Post
          DROP DATABASE dbname.
          Problem is that you have to create the database and set users again
          Radio and TV Player for vBulletin

          Comment


          • #6
            Takes 15 seconds to create a schema and assign a user. On a large database it can take a while to drop each individual table.

            Personally, I just use MySQL's GUI Tools to do this so I don't have to worry about command line commands to manage databases and their users.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API - Full / Mobile
            Vote for your favorite feature requests and the bugs you want to see fixed.

            Comment


            • #7
              If you're just wanting to selectively get rid of data issue a DELETE FROM table_name on each table you're wanting to clear. (I know he said completely, but...)
              Anybody who says "it can't be done" will usually be interrupted by somebody who is already doing it.

              Comment


              • #8
                Or loops the SELECT statements
                @[email protected]

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                X