• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to Backup Database - Where is the SQL file located?

    Scheduled Pinned Locked Moved
    FOG Problems
    4
    13
    9.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sam-white
      last edited by

      I use mysqldump to take a backup of all my MySQL databases. Run the command below, changing USERNAME and PASSWORD to your MySQL info. *** = a directory somewhere. It will save all your databases in a gzip file. Filename will look like this if done today “database_2012-03-09”.

      mysqldump -u USERNAME -pPASSWORD --all-databases | gzip > /***/MySQLBackups/database_date '+%Y-%m-%d'.sql.gz

      1 Reply Last reply Reply Quote 0
      • S
        sam-white
        last edited by

        I usually keep my backups separate, especially with all my images. I take great care with those since I believe they are the most important. I copy my images as is to 2 different locations for backup purposes. You can get by with my post above with mysqldump. I do a backup of my Apache websites. You can use the command below.

        tar -czPf /***/Apache2/apache2_date '+%Y-%m-%d'.tar /var/www/

        1 Reply Last reply Reply Quote 0
        • C
          CASEY
          last edited by

          With this command (and similar ones) I always get the error message as follows:

          [I][B]mysqldump: Got error: 1045: Access denied for user ‘fog’@‘localhost’ (using password: YES) when trying to connect[/B][/I]

          1 Reply Last reply Reply Quote 0
          • S
            sam-white
            last edited by

            I use “root” to backup all my databases. That or you will need to “GRANT” permissions to the FOG user. Also make sure your PASSWORD has no space after “-p”.

            1 Reply Last reply Reply Quote 0
            • C
              CASEY
              last edited by

              That did it!!! Thanks!

              How do I restore it after say a fatal event occurs…

              Should I start a new thread?

              1 Reply Last reply Reply Quote 0
              • S
                sam-white
                last edited by

                [FONT=Verdana][COLOR=#333333]mysql -u USERNAME -pPASSWORD < filename.sql[/COLOR][/FONT]

                [FONT=Verdana][COLOR=#333333]Where “filename.sql” is the backup file you created. Make sure to unzip the file before restoring the database if you used gzip from my earlier post.[/COLOR][/FONT]

                1 Reply Last reply Reply Quote 0
                • falkoF
                  falko Moderator
                  last edited by

                  when restoring after a ‘disaster’ do you build Ubuntu, Install FOG, then import the dump? does the server have to have the same IP etc

                  1 Reply Last reply Reply Quote 0
                  • S
                    sam-white
                    last edited by

                    You need to install FOG before you restore. The IP address should not matter when restoring a backup. You might have to go to the webpage and change the IP address under Other Info > FOG Settings. I have never changed IP’s when moving FOG so I am not sure if you need to do that.

                    1 Reply Last reply Reply Quote 0
                    • C
                      chad-bisd Moderator
                      last edited by

                      I only dump and restore the fog database, not the entire mysql instance. Minor changes to the commands used, documented well in the mysqldump section of the mysql website.

                      You can also tar+gzip your /opt/fog/, /var/www/fog/, and /tftpboot/ folders to preserve your fog installation. I host my images on a raid 5 array, so hopefully I do not lose them because of a disk failure. I have almost a 400GB of image files, so backing them up to another location takes a while.


                      If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

                      1 Reply Last reply Reply Quote 0
                      • falkoF
                        falko Moderator
                        last edited by

                        i backup the images though not such a big thing for me as i only have 2 soon to be 3 images when i start testing/deploying window 7 x64.

                        1. windows 7 all software deployed with SAD2 driver tool
                        2. windows 7 all software deployed with SAD2 driver + games

                        also my two master images are Virtual machines in virtualbox and get backed up from my box to a 2nd HD and to our servers along with fog mysql database, full inventory reports etc

                        1 Reply Last reply Reply Quote 0
                        • S
                          sam-white
                          last edited by

                          [LEFT]You can restore a single database from a mysqldump of all-databases.[/LEFT]
                          [LIST]
                          [*]mysql -u root -p[I]PASSWORD[/I] --one-database [I]DB[/I] < [I]DBfilename[/I].sql
                          [/LIST]
                          [INDENT=1][LEFT][url]http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_one-database[/url][/LEFT][/INDENT]

                          1 Reply Last reply Reply Quote 0
                          • S
                            sam-white
                            last edited by

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post

                            146

                            Online

                            12.1k

                            Users

                            17.3k

                            Topics

                            155.4k

                            Posts
                            Copyright © 2012-2024 FOG Project