Glossary Item Box

Squirrelcart v6.1.0

Importing a Database Backup

Overview

The database files used by Squirrelcart are plain text format, and have the file extension ".sql". A SQL file contains query statements that can be used to alter your database. You can also use database backup files to restore your database to a previous state. There are a few ways to import database files. We will discuss the most common methods below. Please take caution when overwriting an existing database with new data.

Importing a Database File Using Squirrelcart's Control Panel 

Squirrelcart's control panel backup utility is designed to import database files on top of your existing database, and is usually used to upgrade to a newer version. You can also restore a complete database backup on top of your existing backup if the backup was created with the add drop table option. This causes MySQL to delete your existing tables before attempting to replace them with the versions from the backup file. You cannot restore a database backup to an empty table using the control panel.

  1. Click the Backup menu link


    If you have any database files in your sc_data/sc_backup folder they will appear in a table. If the backup you wish to import is listed in the table, skip to step 5
  2. Click the  button

    You should see a new section appear.
  3. Click the browse button and locate your database file.

  4. Click the Upload link. Your file should be uploaded and will appear in the table.
  5. Click the  button to import your backup file.
  6. You will see a caution message, asking to confirm the import:


    Click Yes, Import.
  7. If successful, you should get a message similar to this:
    "Import successful! 26 rows affected."
Importing a Database File Using a Command Shell

This section explains how to import a database file from either a Unix/Linux or Windows command prompt. The steps involved to access a command prompt vary depending on your OS, and will not be discussed here.

  1. Open your command shell application
  2. Navigate to folder that contains the "mysql" command.
  3. Enter the command to mysql as follows:

    mysql -ufred -pwilma my_database < mybackup.sql


    In the above example:
    • fred is the username with access to the database
    • wilma is the password for that account
    • my_database is the name of the database
    • mybackup.sql is the name of the file you wish to use for the backup.

    The first 3 parameters match the information you entered in Squirrelcart's config.php file.

 

 


© 2001-2017 Lighthouse Development. All Rights Reserved.