The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cannot find SQL backup file for restore

Discussion in 'Database Discussions' started by dc7, Feb 18, 2012.

  1. dc7

    dc7 Registered

    Joined:
    Feb 18, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I regularly did backups of my site via CPanel > Backups > Full Backup, by pressing the 'download or generate a full website backup'.

    (I also did it under the Partial Backups too - not sure if that means anything).

    Anyway, my site was built on a Wordpress platform and I mistakenly uninstalled Wordpress so my site got entirely wiped out. I was able to successfully restore the home directory from the backup file. But I have not been able to successfully restore the MySQL database. The MySQL backup file is only 4K, which seems to small to hold my entire database.

    I opened the .gz MySQL backup file and this is all that is in it:

    - - - - - - - - -
    -- MySQL dump 10.11
    --
    -- Host: localhost Database: (database_name)
    -- ------------------------------------------------------
    -- Server version 5.0.92-community-log

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE='+00:00' */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

    --
    -- Temporary table structure for view `titles_data`
    --

    DROP TABLE IF EXISTS `titles_data`;
    - - - - - - - - - - - -

    From reading online, it seems that this file should actually contain a bunch of insert commands and data that are used to rebuild all of the dozen or so tables that were in my database. Above only shows one table called titles_data. All of my backups I've done over time look like this. I am worried this backup function didn't work correctly and it is missing 95% of the tables needed to rebuild the database.

    I am new to Web Development so any insight would be appreciated.
     
    #1 dc7, Feb 18, 2012
    Last edited: Feb 18, 2012
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    In the full backup should be a mysql directory that would contain the MySQL databases for your account.

    GL!
     
  3. dc7

    dc7 Registered

    Joined:
    Feb 18, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thanks for the quick response - and on a Saturday!

    In the full backup file, I see three sql related top level folders/files:

    - mysql folder
    - mysql-timestamps folder
    - mysql.sql file

    A.) I went to the mysql folder and it contains two pertinent files I think:
    - database_name.create
    - database_name.sql (4k size)

    File 'database_name.sql' file shows the same data as I mentioned above. It only references one table (titles_data) of the dozen or so tables that were in the database.

    The table 'titles_data' is one of two tables that I created in the database (the others were mostly default tables created by Wordpress from the install). Is it possible that I set up the table in a weird way by mistake and it is a master table of some kind that excluded the others? Or maybe the cPanel backup function just didn't work correctly?

    B.) Looking in the sql-timestamps folder - I don't think I see any pertinent files here.

    C.) mysql.sql file
    I opened the file and it contains about a dozen lines of data with Grant Usage and Privileges stuff that I don't think is what we need.

    So I think I still don't see the correct data in the SQL backup file that I think is needed for the restore. Hopefully I am missing something!

    Thanks.
     
    #3 dc7, Feb 18, 2012
    Last edited: Feb 18, 2012
  4. tanfwc

    tanfwc Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    94
    Likes Received:
    0
    Trophy Points:
    6
    Is this your own server or your hosting provider? If it is yours, you might want to look at /home/username and see if you have any luck that your previous backup is still there
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This one is the proper directory, but that sql sounds like it contains no data.

    How are your backup settings in WHM set up? If you have no access to WHM, you might want to get in touch with your Hosting Provider and find an older backup. If you have an older backup, take a look in that one's mysql directory.

    The Internet never sleeps, and I hate missing anything. :p
     
  6. dc7

    dc7 Registered

    Joined:
    Feb 18, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thanks everyone for the follow ups.

    I use a hosting service and have been working with them on this as well. They've gone through my most recent backup files as well as previous backups in detail (I've been backing up a few times a month since last summer) and have not yet found a SQL backup file with all of my table data in it.

    fyi - The only backup process I have ever done is through the cPanel backup wizard interface. I also have backup files that I downloaded to my home computer but I believe they are just copies of the backups that I did through the cPanel backup interface.

    Sounds like I should also be doing other backup processes too. Can you offer any suggestions in addition to your WHM idea?
    - WHM - can automatic scheduled backups be set up there?
    - phpMyAdmin backups?
    - exporting tables to csv files?

    I'll take another look through all of my past backups and see if I get lucky. Miracles happen!

    Thanks again.
     
  7. dc7

    dc7 Registered

    Joined:
    Feb 18, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I did some additional checking - I looked at the sql backups I did for another small wordpress site I have. That database_name.sql file is 1.2MB and contains all of types of table and code data that we didn't see in this one.

    So the end result is that I think I set up one of the tables (titles_data) in the database in a really really weird way somehow, which caused only it to backup and excluded the others. I do remember that when I used to go into phpMyAdmin and would see the list of all of the tables, the 'titles_data' table would always have a notation that said "Running" or "In Use" or something like that. None of the other tables showed that. I thought it was curious but didn't know any different.

    So I believe the data just never got backed up anywhere and I will have to rebuild manually. The bummer is that it was a robots in the movies and tv shows database site and I was up to 250 individual title pages with custom written plot descriptions, along with cast lists, promo poster pics, video trailers, etc. It was my three semester master project that I made in school and it was going to be my portfolio piece to look for work in Web Development.

    Thanks again for your follow ups. My first time posting in a forum anywhere and it was a good experience.

    Back to the workshop...
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I would suggest taking a mysqldump of all server databases if you have that access. It's a relatively simple command to do so:

    Code:
    mysqldump --add-drop-table --all-databases | gzip > /home/alldatabases$(date +%y%m%d).sql.gz
    If the database exists in MySQL, this command will save it in the backup archive in /home/alldatabasesYYMMDD.sql.gz location where YY is the 2 digit year, MM is the 2 digit month, and DD is the 2 digit day. This way, if somehow the cPanel MySQL backup didn't contain the database, there would still be a good chance it was in that archived backup using MySQL directly.

    Additionally, you could cron this to run periodically by adding a cron command to /var/spool/cron/root location.
     
Loading...

Share This Page