Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Let me know how can i take mysql server backup without stopping it. Also if some scripts are available for same. what are the thing should remember while taking a backup.
I think mysql comes with its own backup tool but I forget what it is. Anyway, you could always simply backup the mysql database directory which is probably /var/lib/mysql.
No! you cannot just backup the mysql dir... If you do you will end up with a non working database...
But mysql comes with two ways of doing the backups...
mysqldump -creates a full backup that you pipe into a file
example:
mysqldump -a -B test > backup_of_test.sql
creates a full backup of "test" database and puts it all into a file called "backup_of_test.sql".
To restore the file just do "mysql -p test < backup_of_test.sql"...
The other way is to do a mysqlhotcopy...
If you are new to mysql I suggest you use mysqldump, look at the man page for more extensive information...
Originally posted by jonas_larson No! you cannot just backup the mysql dir... If you do you will end up with a non working database...
I beg to differ. Although using mysqldump is the preferred way to backup a database you can simply copy the .MYI,.MYD, and .FRM files as well. It has worked for me numerous times in the past.
I beg to differ. Although using mysqldump is the preferred way to backup a database you can simply copy the .MYI,.MYD, and .FRM files as well. It has worked for me numerous times in the past.
That is true only if your database in down, otherwise your database will (or can) be corrupt when you do a restore...
But you might be lucky and nothing at all happens whith your database and then it will work, but I wouldn't trust that backup... ;o)
I've now searched about 25 threads on incremental backups, and there is usually a dead silence when it comes to the topic. Does anyone know of any way to back up directories incrementally, especially Lotus Notes databases?
Does anyone know of any way to back up directories incrementally, especially Lotus Notes databases?
Notes database files are regular files! (if you are running a new version of Notes...)
So any tool that can do a incremental will do! (tar, cpiol,amanda)
The only thing you need to think about is to shut down notes before the backup to make sure no writes are done while doing the backup...
mysqldump -a -B test > backup_of_test.sql
creates a full backup of "test" database and puts it all into a file called "backup_of_test.sql".
To restore the file just do "mysql -p test < backup_of_test.sql"...
Could I run on my desktop mysqldump as above copy the sql file to floppy and do the restore on a seperate machine, like a laptop??
That is "the right way" to do it. It will work great, the only thing you might have to adjust is the user. (if you had some other user on your laptop...)
Recently, we are talking like 2 days ago, I had to restore a database that wasn't working very well. I tried restoring from another backup solution, and only ended up screwing myself bigtime. Eventually, what worked for me was pulling out a full backup of /var and grabbing the files from /var/lib/mysql/DATABASE and copying them over, file by file (the imssing ones that the mysqldump seemed to have problems remembering to grab?) and got the pup restored.
So, it may be the "right way" but in my sad situation, if I had solely followed the "right way" I'd have been screwed. It took a combo of both "the right way" and apparently "the wrong way" to get things restored and in working order.
I never said you couldn't restore from /var/lib/mysql (or where ever you put the files...) if you shut down mysql first...
The discussion was about a "hot" backup, i.e. taking a backup while the database is up. (in use) The problem you might get is that some table is in the progress of updating it's data and in that instance you copy the files -> thus getting a mixture of old and new data...
I say "might" because it is not sure that will happen. You might be able to take a backup that way 99 times of 100. The problem is the 100th time... ;o)
Right on I meant nothing from that other than that you were both correct, especially since it took a combo of both of your ways to get mine back up when it jumped ship I understand and can completely appreciate "the correct" way to do things, and thank you for the information as such
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.