Difference between revisions of "Maintenance"

From WHMCS Documentation

m (Resetting your database)
Line 1: Line 1:
 
__TOC__
 
__TOC__
 
==Resetting your database==
 
==Resetting your database==
After you successfully install your billing system you should run through a series of tests. This includes creating client accounts and placing test orders with your particular setup. Often, once you have finished your testing you will no longer want any of these clients or orders in your system.  All you need to do is reset your system and all your test accounts will be removed.  
+
After you successfully install your billing system, run through a series of tests, including creating client accounts and placing test orders with your particular setup. Often, after you have finished your testing, you will no longer want any of these clients or orders in your system.  All you need to do is reset your system, which will remove all of your test accounts.  
  
You can empty all the tables that contain clients data by running the following SQL code on your database:  
+
You can empty all the tables that contain clients' data by running the following SQL code on your database:  
  
TRUNCATE `mod_invoicedata` ;
+
<div class="source-cli">
TRUNCATE `tblaccounts` ;
+
TRUNCATE `mod_invoicedata` ;
TRUNCATE `tblactivitylog` ;
+
<br/>TRUNCATE `tblaccounts` ;
TRUNCATE `tblaffiliates` ;
+
<br/>TRUNCATE `tblactivitylog` ;
TRUNCATE `tblaffiliatesaccounts` ;
+
<br/>TRUNCATE `tblaffiliates` ;
TRUNCATE `tblaffiliateshistory` ;
+
<br/>TRUNCATE `tblaffiliatesaccounts` ;
TRUNCATE `tblaffiliatespending` ;
+
<br/>TRUNCATE `tblaffiliateshistory` ;
TRUNCATE `tblaffiliateswithdrawals` ;
+
<br/>TRUNCATE `tblaffiliatespending` ;
TRUNCATE `tblbankaccounts`;
+
<br/>TRUNCATE `tblaffiliateswithdrawals` ;
TRUNCATE `tblbillableitems` ;
+
<br/>TRUNCATE `tblbankaccounts`;
TRUNCATE `tblcancelrequests` ;
+
<br/>TRUNCATE `tblbillableitems` ;
TRUNCATE `tblclients` ;
+
<br/>TRUNCATE `tblcancelrequests` ;
TRUNCATE `tblclientsfiles` ;
+
<br/>TRUNCATE `tblclients` ;
TRUNCATE `tblcontacts` ;
+
<br/>TRUNCATE `tblclientsfiles` ;
TRUNCATE `tblcredit` ;
+
<br/>TRUNCATE `tblcontacts` ;
TRUNCATE `tblcreditcards`;
+
<br/>TRUNCATE `tblcredit` ;
TRUNCATE `tblcustomfieldsvalues` ;
+
<br/>TRUNCATE `tblcreditcards`;
TRUNCATE `tbldomains` ;
+
<br/>TRUNCATE `tblcustomfieldsvalues` ;
TRUNCATE `tbldomainsadditionalfields` ;
+
<br/>TRUNCATE `tbldomains` ;
TRUNCATE `tblemails` ;
+
<br/>TRUNCATE `tbldomainsadditionalfields` ;
TRUNCATE `tblhosting` ;
+
<br/>TRUNCATE `tblemails` ;
TRUNCATE `tblhostingaddons` ;
+
<br/>TRUNCATE `tblhosting` ;
TRUNCATE `tblhostingconfigoptions` ;
+
<br/>TRUNCATE `tblhostingaddons` ;
TRUNCATE `tblinvoiceitems` ;
+
<br/>TRUNCATE `tblhostingconfigoptions` ;
TRUNCATE `tblinvoices` ;
+
<br/>TRUNCATE `tblinvoiceitems` ;
TRUNCATE `tblnotes` ;
+
<br/>TRUNCATE `tblinvoices` ;
TRUNCATE `tblorders` ;
+
<br/>TRUNCATE `tblnotes` ;
TRUNCATE `tblpaymethods`;
+
<br/>TRUNCATE `tblorders` ;
TRUNCATE `tblquotes` ;
+
<br/>TRUNCATE `tblpaymethods`;
TRUNCATE `tblquoteitems` ;
+
<br/>TRUNCATE `tblquotes` ;
TRUNCATE `tblsslorders` ;
+
<br/>TRUNCATE `tblquoteitems` ;
TRUNCATE `tblticketlog` ;
+
<br/>TRUNCATE `tblsslorders` ;
TRUNCATE `tblticketnotes` ;
+
<br/>TRUNCATE `tblticketlog` ;
TRUNCATE `tblticketreplies` ;
+
<br/>TRUNCATE `tblticketnotes` ;
TRUNCATE `tbltickets` ;
+
<br/>TRUNCATE `tblticketreplies` ;
TRUNCATE `tblupgrades` ;  
+
<br/>TRUNCATE `tbltickets` ;
 +
<br/>TRUNCATE `tblupgrades` ;  
 +
</div>
  
Note: Resetting your database only deletes client accounts and information. You will not lose any configuration or product settings you have setup.
+
<div class="docs-alert-warning">
 +
<span class="title">Note</span><br />
 +
Resetting your database only deletes client accounts and information. You will not lose any configuration or product settings.
 +
</div>
  
 
==Backing up your WHMCS Database==
 
==Backing up your WHMCS Database==
It is strongly recommended that you backup your WHMCS Database regularly to ensure you always have a copy of your data should a server or system failure occur.  Backing up the database is a very simply task with the built in backup tool.  This is how to use it:  
+
We strongly recommend that you back up your WHMCS database regularly to ensure you always have a copy of your data in case of system failure.  Backing up the database is simple using the built-in backup tool:
  
#Login to your WHMCS Admin Area  
+
#Log in to your WHMCS Admin Area.
#Go to Utilities > Database Status  
+
#Go to '''Utilities > Database Status'''.
#Click the Download Full Database Backup button at the top of the page  
+
#Click the '''Download Full Database Backup''' button at the top of the page. The system will prompt you to download a file.
#You should be prompted for a file to download. Save the file to your computer. Depending on the database size, this may take a few moments.
+
#Save the file to your computer. Depending on the database size, this may take a few moments.  
#Once the download is complete you have now backed up your database.
 
  
 
==Restoring a Database Backup==
 
==Restoring a Database Backup==
If you need to restore a backup of your database then you will need to use the following steps.  If you have not already recreated your database, do so now.  If your database is created, you must drop the existing WHMCS tables.  
+
If you need to restore a backup of your database, you will first need to recreate your database, if you haven't already, and drop the existing WHMCS tables.
  
#Log in to phpMyAdmin and select the database you want to restore the backup to
+
To restore a database:
#Click the Import tab at the top <br /><br />[[Image:maintenance1.png]] <br /><br />
+
 
#Click the Browse button  
+
#Log in to phpMyAdmin and select the database you want to restore.
#Browse to find your backup file and then press OK  
+
#Click the '''Import''' tab at the top: <br /><br />[[Image:maintenance1.png]] <br /><br />
#Click Go <br /><br />[[Image:maintenance2.png]]
+
#Click the '''Browse''' button.
 +
#Find your backup file and then press '''OK'''.
 +
#Click '''Go'''. <br /><br />[[Image:maintenance2.png]]

Revision as of 19:08, 12 May 2020

Resetting your database

After you successfully install your billing system, run through a series of tests, including creating client accounts and placing test orders with your particular setup. Often, after you have finished your testing, you will no longer want any of these clients or orders in your system. All you need to do is reset your system, which will remove all of your test accounts.

You can empty all the tables that contain clients' data by running the following SQL code on your database:

TRUNCATE `mod_invoicedata` ;
TRUNCATE `tblaccounts` ;
TRUNCATE `tblactivitylog` ;
TRUNCATE `tblaffiliates` ;
TRUNCATE `tblaffiliatesaccounts` ;
TRUNCATE `tblaffiliateshistory` ;
TRUNCATE `tblaffiliatespending` ;
TRUNCATE `tblaffiliateswithdrawals` ;
TRUNCATE `tblbankaccounts`;
TRUNCATE `tblbillableitems` ;
TRUNCATE `tblcancelrequests` ;
TRUNCATE `tblclients` ;
TRUNCATE `tblclientsfiles` ;
TRUNCATE `tblcontacts` ;
TRUNCATE `tblcredit` ;
TRUNCATE `tblcreditcards`;
TRUNCATE `tblcustomfieldsvalues` ;
TRUNCATE `tbldomains` ;
TRUNCATE `tbldomainsadditionalfields` ;
TRUNCATE `tblemails` ;
TRUNCATE `tblhosting` ;
TRUNCATE `tblhostingaddons` ;
TRUNCATE `tblhostingconfigoptions` ;
TRUNCATE `tblinvoiceitems` ;
TRUNCATE `tblinvoices` ;
TRUNCATE `tblnotes` ;
TRUNCATE `tblorders` ;
TRUNCATE `tblpaymethods`;
TRUNCATE `tblquotes` ;
TRUNCATE `tblquoteitems` ;
TRUNCATE `tblsslorders` ;
TRUNCATE `tblticketlog` ;
TRUNCATE `tblticketnotes` ;
TRUNCATE `tblticketreplies` ;
TRUNCATE `tbltickets` ;
TRUNCATE `tblupgrades` ;

Note
Resetting your database only deletes client accounts and information. You will not lose any configuration or product settings.

Backing up your WHMCS Database

We strongly recommend that you back up your WHMCS database regularly to ensure you always have a copy of your data in case of system failure. Backing up the database is simple using the built-in backup tool:

  1. Log in to your WHMCS Admin Area.
  2. Go to Utilities > Database Status.
  3. Click the Download Full Database Backup button at the top of the page. The system will prompt you to download a file.
  4. Save the file to your computer. Depending on the database size, this may take a few moments.

Restoring a Database Backup

If you need to restore a backup of your database, you will first need to recreate your database, if you haven't already, and drop the existing WHMCS tables.

To restore a database:

  1. Log in to phpMyAdmin and select the database you want to restore.
  2. Click the Import tab at the top:

    Maintenance1.png

  3. Click the Browse button.
  4. Find your backup file and then press OK.
  5. Click Go.

    Maintenance2.png