CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   MySQL (http://www.codingforums.com/forumdisplay.php?f=7)
-   -   Organising tables mysql (http://www.codingforums.com/showthread.php?t=283948)

shaunthomson 12-11-2012 01:35 AM

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

BubikolRamios 12-11-2012 01:53 AM

My guts tells me you have 1 table for each account. Terribly wrong.

read this

All together you need 3 tables (accounts,products,archives)

shaunthomson 12-11-2012 02:21 AM

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

Old Pedant 12-11-2012 02:22 AM

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.

Old Pedant 12-11-2012 02:27 AM

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.


All times are GMT +1. The time now is 09:46 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.