Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-11-2012, 01:35 AM   PM User | #1
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 89
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
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
shaunthomson is offline   Reply With Quote
Old 12-11-2012, 01:53 AM   PM User | #2
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
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
BubikolRamios is offline   Reply With Quote
Old 12-11-2012, 02:21 AM   PM User | #3
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 89
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
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
shaunthomson is offline   Reply With Quote
Old 12-11-2012, 02:22 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
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.

Last edited by Old Pedant; 12-11-2012 at 02:24 AM..
Old Pedant is offline   Reply With Quote
Old 12-11-2012, 02:27 AM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.