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 5 of 5
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    89
    Thanks
    51
    Thanked 0 Times in 0 Posts

    Organising tables mysql

    Hi

    Just wondering if there is a way to store mysql tables in a typical tree dir structure?

    So for example, instead of having 20 tables, have 10 tables under an accounts folder, 5 under products, 5 under archives...

    Cheers

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    My guts tells me you have 1 table for each account. Terribly wrong.

    read this

    All together you need 3 tables (accounts,products,archives)
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #3
    New Coder
    Join Date
    May 2012
    Posts
    89
    Thanks
    51
    Thanked 0 Times in 0 Posts
    No no nooooooooooooooooooooooo!!!!!

    I only have one table for accounts etc, but the DB is for a song list web app, so there are a few tables that take care of...

    - songs
    - requests
    - gig guide
    - venues
    - song book accounts
    - public user accounts
    - user logged tokens
    - password reset keys
    - social networking relationships
    - messages
    - advertising

    etc...

    I just wanted to know if I can set up a dir somewhere in the database to store the archive tables that I create over time?

    Cheers

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,620
    Thanks
    78
    Thanked 4,388 Times in 4,353 Posts
    Use a different database, then.

    I do that.

    I have a database named "backups".

    And when I need to I do something simllar to this:
    Code:
    CREATE TABLE backups.accounts_20121210 LIKE accounts;
    
    INSERT INTO backups.accounts_20121210 SELECT * FROM accounts;
    And, yes, you could have databases named "accounts_backup", "products_backup", etc., if you wanted.
    Last edited by Old Pedant; 12-11-2012 at 02:24 AM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,620
    Thanks
    78
    Thanked 4,388 Times in 4,353 Posts
    I should note that storing backups in the same database on the same server on the same disk drive is not a good idea. One disk drive failure and everything is gone.

    At the minimum, you should have two disk drives and then tell MySQL to put the backups tables on the backup disk drive. (Yes, MySQL can store different databases on different drives.)

    Better is to use mysqldump to create text files as backups and store them offline and/or on some other server.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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