LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 05-07-2007, 01:15 AM   #1
dc_eros
Member
 
Registered: Nov 2006
Distribution: Slackware
Posts: 292

Rep: Reputation: 39
Where can i find the MySQL database file in Linux Filesystem


I'm an MS Access user for several years, then I switch to MySQL. I know how to backup and restore the database in MySQL in a Linux environment, but it only works when the MySQL daemon is running. One time, our server (SuSE Linux 9.3 Prof) crashes, and I can't run all the services, and one of them is MySQL, so I have trouble making backup of our School's Forum.

I tried to search the entire filesystem to find the exact file where my tables are located but I'm not sure what i'm doing. I noticed, in Windows, MySQL tables are saved as .frm files, ex. msgboard.frm.

So here are my questions:

1. What directory the MySQL database is stored (in Linux of course)?
2. If ever i find those files, is there any commands to restore those database file to another system? In windows, I copied and paste it, but it doesn't work of course. is there a way on restoring those files? (not mysqldump files)

Another: I have some trouble in restoring my backups. When I make backup, i used this command.

mysqldump db_name -u root -p > our_db_backup.sql

And when i need to restore the database, i need to append the name of the database to all tables of the entire SQL script like this:

create table 'table_name' ...

to

create table 'db_name'.'table_name' ....

so that this restoration works:

mysql -u root -p < our_db_backup.sql


Is there any way so that I don't have to edit the SQL script evertime i need to restore the database? I think there's a switch lacking.

I really appreciate your help. Thank you.
 
Old 05-07-2007, 03:16 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,456

Rep: Reputation: 104Reputation: 104
to restore the database, create it first then
mysql yourDATABASENAME < yourSQL.sql -u root -p

Your data reside in a directory that you may find reading
/etc/my.cnf
look for data directory entry. Could be somewhere in /var/lib/mysql but depending on how you installed mysql it can be anywhere.
Why dont you start the server and make a dump?
 
Old 05-09-2007, 05:27 AM   #3
dc_eros
Member
 
Registered: Nov 2006
Distribution: Slackware
Posts: 292

Original Poster
Rep: Reputation: 39
Making automatic backup

Ok, i have now learned how to restore from my dump file. thank you very much dude.

I want to make an automatic backup of my database, that is i want to make backup weekly.

I know how to make script, but i want to know what is the name of the program that run applications scheduled, even if the user is not logged in. is it "cron" ???

tnx in advance.
 
Old 05-09-2007, 07:03 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,456

Rep: Reputation: 104Reputation: 104
maybe there are directories for cron jobs on your box already. If so you can place your script there and have it executed automatically.

i. e.
/etc/cron.daily
/etc/cron.hourly
 
Old 05-09-2007, 12:54 PM   #5
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,490

Rep: Reputation: Disabled
Quote:
Originally Posted by dc_eros
1. What directory the MySQL database is stored (in Linux of course)?
Check the file that starts the service. On Slack it is /etc/rc.d/rc.mysqld. You will see that mysql is launched with a "--datadir=" option which specifies the location of the database files.

Brian
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need to get data from xml file to MySQL database, and then use php to access Armon Linux - General 1 01-18-2006 03:54 PM
where can i find mysql log file myheart Linux - Networking 6 01-07-2005 05:36 AM
DISCUSSION: Virtual Filesystem: Building a Linux Filesystem from an Ordinary File mchirico LinuxAnswers Discussion 0 10-28-2004 11:35 PM
MySQL: Importing a database from an XML file concoran General 0 09-08-2003 03:58 AM
Importing FreeBSD mysql database to RedHat Linux 7.3 RKris Linux - Software 6 05-06-2003 05:07 AM


All times are GMT -5. The time now is 04:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration