Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MySQL - where are the actual databases (files) are located ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Johnyp
Guru
Guru


Joined: 23 Mar 2005
Posts: 301

PostPosted: Fri Jun 03, 2005 8:54 pm    Post subject: MySQL - where are the actual databases (files) are located ? Reply with quote

Hey all
I'm new to databases and i have couple of sites running using MySQL ... but i have no idea where the actual database files (ones holding all my data) are located? I want to know where they are so i can back them up...

Thanks all :)
_________________
Gentoo Unanswered Questions- Give it a try!
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Fri Jun 03, 2005 9:10 pm    Post subject: Reply with quote

Check /var/lib/mysql/

If you haven't already, emerge slocate and learn how to use it. Very handy indeed!
Back to top
View user's profile Send private message
dejima
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2004
Posts: 130
Location: Greece

PostPosted: Sat Jun 04, 2005 12:02 am    Post subject: Reply with quote

To backup your databases use also mysqldump.
Using this tool you could specify whether you want all of your databases backed up or just one of them.
Back to top
View user's profile Send private message
Stolz
Moderator
Moderator


Joined: 19 Oct 2003
Posts: 3028
Location: Hong Kong

PostPosted: Sat Jun 04, 2005 5:55 am    Post subject: Reply with quote

this is the script I use to backup my DB:
Code:
#!/bin/sh
DATUM=`date '+%Y-%m-%d'`
DIR='/home/stolz/DBbackup'
FILE='backup.sql'
mysqldump -u stolz -p topsecret -hlocalhost --opt mydatabase > ${DIR}/${FILE}
gzip -9 --best ${DIR}/${FILE}
chmod 700 ${DIR}/${FILE}.gz
mv ${DIR}/${FILE}.gz ${DIR}/${DATUM}-${FILE}.gz


May be there is a more elegant way, but it do the job for me :)
Just remember to add a cron job for run it periodically.

Hope it helps.
Back to top
View user's profile Send private message
dejima
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2004
Posts: 130
Location: Greece

PostPosted: Sat Jun 04, 2005 8:51 pm    Post subject: Reply with quote

I use a script like Stolz's.
The only difference is that I don't rotate my backup files through the script.
I use logrotate for this reason.
Using logrotate gives you the option to compress,change ownership and rights of the file you are rotating.You could specify when you want your file to be rotated(weekly,monthly....)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum