View Single Post

  #6 (permalink)  
Old 04-18-2008
Vahis
 
Posts: n/a
Default Re: Scripting a backup by phpMyAdmin, or the equivalent?

On 2008-04-18, Jonathan Sachs <js070717@sbcglobal.net> wrote:
> On Mon, 14 Apr 2008 13:53:47 GMT, "Ana C. Dent"
><anacedent@hotmail.com> wrote:
>
>>Those who live by the GUI, die by he GUI.
>>
>>use mysqldump instead

>
> I tried that technique, but I don't think it's going to work for me.
>
> I found mysqldump, which turned out to be a utility in MySQL's own
> private environment rather than an application that I can put directly
> in a batch file.
>
> I configured the MySQL monitor (which I otherwise have had no reason
> to use).
>
> I found documentation which explains how to run mysqldump, but which
> requires me to dig out details of several technical things that I've
> not encountered before. (When is an option preceded by a double
> hyphen? What does '-p' followed by no password mean?)
>
> Then I'll have to figure out how to run the monitor from a script, and
> then how to run mysqldump from a script inside the monitor.
>
> This is supposed to SAVE me time, not consume it.
>
> I'd love to become an expert user of MySQL, but I don't have that
> luxury. I'm working on a project of which MySQL is a necessary but
> incidental part. I need to spend my time on the project.
>
> If this is the only way I can automate a backup, I'll have to continue
> doing it through the GUI until I have time to learn all that stuff...
> maybe next Christmas.
>
> I hope someone can suggest a simpler way.


I did already. I posted a shell script that can be run in cron.
You can edit that script to your needs.
Maybe you didn't follow. OK.

There was stuff you don't need, (gallery2 part) so here's just the
backup command:

mysqldump --opt -Q -uroot -pYourPasswordComesHere nameofyourdatabase >
/path/to/backupfiles/nameofyourdatabase.sql

Put everything in one line and run that in cron if you want automation.

In my earlier post there was datetime for making a new backup file each
time, see my earlier post. The command above overwrites the backup file
each time.

See that post and come back with the parts you don't understand.

And here's yet the restore command:

mysql -uroot -pYourPasswordHere yourdatabase < /path/to/backupfile.sql

The commands here are run as database root. You may run them as any
other user that has privileges.

Vahis
--
Training new things here:
http://waxborg.servepics.com
"The only thing more expensive than training is the lack of it"
Henry Ford
Reply With Quote