[OT] a mysql question

jan gestre freebsd.ph at gmail.com
Wed Oct 25 01:53:09 UTC 2006


On 10/25/06, Jonathan Horne <freebsd at dfwlp.com> wrote:
>
> typical OT thread apologies, but the truth *really* is that this is the
> best
> and most intelligent list i read. so...
>
> i use veritas netbackup 5.1 to backup my bsd machines, and i would like to
> restore some mysql databases onto another machine.  is restoring any mysql
> database, as simple as reloading the database directories in
> /var/db/mysql?
> do i need to create the blank database first, then do it?
>
> i do know how to import a .sql database dump, i was just wondering if i
> can do
> it via a restore job from netbackup.  any opinions i can get, are greatly
> appreciated.
>
> i'm not a mysql guru but backing up and restoring a mysql database is just
like riding a bike, it's that easy :D

to backup a mysql database:

$ mysqldump -u user -p --opt databasename > database.bak.sql

to restore a database from the backup:

$ mysql -u user -p database < database.bak.sql

just make sure user has privileges to do the necessary commands, if not you
can use the root user of mysql. you can also use a gui tool like phpmyadmin
for managing mysql.

cheers


More information about the freebsd-questions mailing list