LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-25-2005, 10:32 PM   #1
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: RedHat (RHEL, FC, CentOS), openSuSE, Mac OS X
Posts: 653

Rep: Reputation: 32
/var/lib/mysql contents - What to backup


Hi there

I am trying to transfer an entire server to a new server and do a whole heap of house keeping while i'm at it. On of the things that has come up early is the databases the old server is hosting. Every subdirectory in /var/lib/mysql is a database as I understand it, so I'm confident that those need to be backed up. I haven't had a close look at the directories but i'm not too phased by that aspect. What has me a little surprised are the main-bin.001 to main-bin.xxx files as well as the main-relay-bin.001 to whatever files.

Anyone know what the purpose of those files (/var/lib/mysql/main-bin.xxx and main-relay-bin.xxx) is, what they do and the like.

(I have googled and found nothing relevant). Any input would be appreachiated.
 
Old 05-25-2005, 10:55 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
Don't backup just those directories.. do it the correct way and do it with mysqldump command.
 
Old 05-25-2005, 10:59 PM   #3
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: RedHat (RHEL, FC, CentOS), openSuSE, Mac OS X
Posts: 653

Original Poster
Rep: Reputation: 32
Good point
 
Old 05-25-2005, 11:25 PM   #4
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: RedHat (RHEL, FC, CentOS), openSuSE, Mac OS X
Posts: 653

Original Poster
Rep: Reputation: 32
Now according to the manual (http://dev.mysql.com/doc/mysql/en/mysqldump.html) the following means are available:

dump a database to a remote host:
shell> mysqldump --opt db_name | mysql --host=remote_host -C db_name

It is possible to dump several databases with one command:
shell> mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql

If you want to dump all databases, use the --all-databases option:
shell> mysqldump --all-databases > all_databases.sql

and

You can read the dump file back into the server like this:
shell> mysql db_name < backup-file.sql

...end copy...

but what it doesn't tell me is how to re-import if all databases are dumped. would i just do the following (for arguments sake):
mysqldump --all-databases > all_databases.sql
scp all_databases.sql another.server.com.au:/some/dir/
<log on to another.server.com.au etc>
mysql < all_databases.sql

Or (even better)
mysqldum --opt --all-databases | mysql --host=another.server.com.au -C

Or what do I put in place of the database name - afterall it would be a hole stack of databases...
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-08-2008 12:48 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:22 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration