Monthly Archive December 28, 2018

How to import and export a database via SSH

How to import and export a database via SSH

You can easily import/export your database using phpMyAdmin menu in cPanel. To do so, follow the instructions here. It allows processing only the databases that do not exceed 50Mb. If your database is bigger, you will need to use SSH commands.

Shell access is disabled on Shared servers by default, so if shell access was not enabled for your account previously, first of all, enable it with the help of this article.

The next step is to log into your account via SSH. This tutorial will guide you through this process.

Note that before performing an export or import, you will need to assign a database to a user. You can do it in cPanel > MySQL Databases menu > Add a User to a Database option:

How to import and export a database via SSH
Make sure that you enable All Privileges option:

How to import and export a database via SSH

You can find more instructions on database creation and assigning it to a user here.

In order to import a database, use the following command:

mysql -u dbusername -pdbpassword dbname < /path/to/file/file.sql

You can also use:

mysql -u dbusername -p’dbpassword’ dbname < /path/to/file/file.sql

or

mysql -u dbusername -p dbname < /path/to/file/file.sql

In order to export, use this one:

mysqldump -u dbusername -pdbpassword dbname > /path/to/file/file.sql

The variable in italics are the following: 

  • dbusername: the name of a database user assigned to this database (it should be in the format of CPANELUSERNAME_DATABASEUSER), or your cPanel username
  • dbpassword: the database user password (if you use a database user as a username) or your cPanel password (if you use your cPanel username as a username)

NOTE: No space between -p key and the password if you enter it in the command.

  • dbname: the name of your database you are importing to or exporting from. It should be created in your cPanel. The format is the following: CPANELUSERNAME_DATABASENAME
  • /path/to/file/file.sql: the path to the mysql dump that you are importing to (then a new file will be created) or exporting from your cPanel account. Here you can use both relative and absolute path formats. If you are in the folder with the file, you can just type the file name with the extension. With the absolute path, for example, it will be the following: /home/CPANEL_USERNAME/public_html/database.sql

If you do not receive any error or notification after pressing Enter, it means that the command was performed successfully.

Let us provide with an example.

We will use the following settings:

  • dbusername: nctests_user (as a database user), nctests (as a cPanel username)
  • dbpassword: 123qwe
  • dbname: nctests_database
  • path to the file: /home/nctests/public_html/databases/db_file.sql

After defining all the variables, the command will look the following way:

Database import

mysql -u nctests_user -p123qwe nctests_database < /home/nctests/public_html/databases/db_file.sql 

How to import and export a database via SSH

NOTE: You can also use the following command:

mysql -u nctests_user -p nctests_database < /home/nctests/public_html/databases/db_file.sql 

This way, you need to enter the password in the next line:

How to import and export a database via SSH

Database export

mysqldump -u nctests_user -p123qwe nctests_database > /home/nctests/public_html/databases/db_file.sql 

How to import and export a database via SSH

NOTE: You can also use the following command:

mysqldump -u nctests_user -p nctests_database > /home/nctests/public_html/databases/db_file.sql 

This way, you need to enter the password in the next line:

How to import and export a database via SSH

That’s it!

How to work with scripts in Softaculous

How to work with scripts in Softaculous

Softaculous is a great tool in cPanel that allows installing different scripts like WordPress, Joomla, Magento, etc. in a click of a button.
However, Softaculous is not just a script installer, it has a number of features, which can make managing your website much easier! So, taking a few minutes to look through this article will definitely show you how to manage your websites in a more efficient way.
First of all, you need to open the Softaculous menu in cPanel. It is located under the Exclusive for Namecheap customers section section of cPanel:

 

Then you can start managing your scripts through Softaculous using this guidance. It will teach you how to:

1. Install software
2. Import an installation
3. Set up auto-backups and auto-upgrades
4. Backup software
5. Restore backups
6. Upgrade software

9. Remove an installation

Install a software

You can install different software on your site in several clicks using the Softaculous auto-installer following this article.

Import an installation

If you are using one of CMS scripts available in Softaculous, but the initial installation was performed in a different way, you can import the installation to Softaculous. You need to know the name of the installed script, and then you are ready to proceed with these steps to import it:

1. Find a script you would like to import using Search or Categories in Softaculous:

2. After you click on the name of the script you wish to import, you will see the main page of that script in Softaculous. Navigate to Import tab:

3. Select a domain name from the drop-down menu and type in a directory where the installation is currently located. In our example we have the WordPress installation in the root folder of nctest.info, so we will keep In Directory field empty. If you have an installation in the subdirectory of your domain, like in nctest.info/wordpress, you will need to type ‘wordpress’:

3. Click on Import button. You will see Congratulations page if everything’s done properly.

Set up auto-backups and auto-upgrades

It is possible to set up auto-backups and auto-upgrades of your script on the installation stage. However, if you forgot to do it, you can enable these options at any other moment. In order to do it, follow the steps:

1. Open All Installations page of Softaculous:

2. Locate the required installation and click on Edit icon:

3. There, you need to put checkmarks in a few checkboxes (as shown in the screenshot below) in order to manage auto-backups and auto-upgrades of your website installation:

4. Click on Save Installation Details at the bottom of the page.

Make sure that you check the notes below carefully:

NOTE 1: Auto-upgrades may fail or break your website, but Softaculous always makes a backup of your installation right before performing an auto-upgrade, so you will be able to return back to a working version of your website by restoring that backup.

NOTE 2: When using Backup Rotation option, you are allowed to set 10 copies maximum per each script you have installed using Softaculous. Thus, when the eleventh copy of your site is generated, it will replace the earliest backup file, the first one, generated for the website installation.

NOTE 3: It is not recommended setting Backup Rotation to more than 4 copies in order not to violate Namecheap Acceptable Use Policy, which states: ‘NO more than 10 GB of a shared hosting account can be allocated to any archive files’.

NOTE 4: Backups created manually will be stored for 28 days. Once this period is over, the backup copy will be removed from the server. Since our hosting service is not intended for storing backup files and other data not related to the website’s operation itself, be advised to download backup files to your local device if you need to store them more than 28 days.

Backup software

Creating a current backup of your website installation is a very simple process with Softaculous. It is enough to do the following:

1. Click on All Installations icon:

2. Locate the required installation and click on Backup icon:

3. Choose whether you would like to back up the entire installation, database or directory with files. Also, you can add a note to your backup and will see some general info about your installation:

4. Click on Backup Installation to start generating the backup.

Restore backups

If something went wrong and your website got corrupted, you can stay calm if you have a backup. Backup restoration allows returning the website to its previous state, and you can do it following these steps:

1. Navigate to Backups and Restore section in Softaculous:

2. There, you can find all available backups of all your websites’ installations. You can choose any of those backups to restore, download or remove using appropriate icons. Also, you will be able to check notes left at the moment of the backup creation. For this, you need to mouse over the notepad icon to see them:

3. After you click on Restore icon, you may choose whether you would like to restore a database or directory with files or both:

4. Once you are ready, click Restore Installation. Several minutes after your installation is returned to its previous state!

Upgrade software

Softaculous allows upgrading software with just one click when you need it. If auto-upgrade is not set up for your installation, you can follow these simple steps to perform an upgrade:

1. Open All Installations page in Softaculous:

2. If a new version of your software is available, you will see a small Upgrade icon under Version section. Click on it:

3. On the next page, it is necessary to check the box Create Backup. It is critical since such automatic upgrades may break your website.

Moreover, before performing an upgrade it is recommended to create another backup of your installation or of the whole account following these instructions:

4. Then click Upgrade to start the process.

It can take a few minutes to complete the process and then you’ll get Congratulations message. It is recommended to check the installation of your website to make sure the upgrade has not broken your website.

If it has broken your website, you will need to restore the backup following the instructions from the Restore backups section of this article.

Clone an installation

If you would like to move/copy the current installation to another directory or even domain, Clone option is exactly what you need.

NOTE 1: Clone option is available for a few scripts only at the moment.

NOTE 2: It may be necessary to update some links/paths in the database of your installation after cloning. Not all of them may be re-assigned to the new domain/directory automatically

Let’s say you have mistakenly installed WordPress to the /wp subfolder instead of the root folder of your domain. In this case, you will need to do the following:

1. Open All Installations page of Softaculous:

2. Click on Clone button:

3. On the next screen, you will see information about the current installation you are cloning. Also, you will need to specify a domain name where you are trying to clone your installation, choose In Directory field and set some other options:

NOTE: In Directory field should be empty if you would like to clone the installation to the root directory of your domain.

4. Click on Clone Installation when you are ready.

Create Staging

As the name suggests, the Create Staging option allows for the testing of upgrades and/or other changes before pushing it to live installation.

1. First, open the All Installations page to see your current website’s installations. See below:

2. Find the installation you want to create staging for and click on Create Staging.

3. Now fill in the respective details for your staging installation:

  • The protocol
  • The domain name in question
  • The directory you wish to set for installation
  • The database name

4. Click on the Create Staging button.

5. On the next page you will see the website URL and the respective link to that website’s dashboard.

PLEASE NOTE: The admin/user account login details will be the same as the ones you used for source installation.

6. As soon as your staging installation is ready, you can now select Push to Live.

PLEASE NOTE: Every time you select Push to Live, Softaculous will automatically create a backup.

7. On the next page you will see two ways to push installation:

  • By default
  • By customization

The Default Push will replace all the files of your live installation with the staging installation ones, effectively erasing the live database import from your staging installation.
With the Custom Push you will be given the opportunity to select those files, databases, table structures, and table data you would like to push.

8. Once you’ve selected your chosen way, click on the Push to Live button. Depending on the size of your installation, the time it takes to go live will vary.

Remove an installation

Deleting an installation is an easy process as well thanks to Softaculous:

1. Open All Installations page to see your current website installations:

2. Find the installation you would like to remove and click on the red cross:

3. On the next screen, you will see general information about the installation you are removing and will be able to choose whether all data of this installation should be removed or not:

4. Click on Remove Installation button.

That’s it!

How to create and restore backups in cPanel

How to create and restore backups in cPanel

In this article you can find the guidelines on creating and restoring backups in cPanel:

for cPanel paper_lantern theme
for cPanel x3 theme

for cPanel paper_lantern theme:

The Backups menu in the section Files allows you to generate/restore backups of:

  • a full cPanel account
  • a MySQL database
  • mail filters
  • mail forwarders

How to create a full cPanel backup

A full cPanel backup includes all account files, databases, email accounts and settings.
We recommend creating a full cPanel backup before any major data modification/migration.

1. Go to cPanel > Files section > Backup menu:

2. Click on Download a Full Website Backup:

3. By default, a full cPanel backup will be saved into your account home directory.
Go ahead and change Backup Destination if you would like to choose another target location for the backup.

Click on Generate Backup to proceed:

4. You will see the following message notifying about the start of the backup generation process:

5. Click on Go Back to monitor the status of the generation process real time.

The green checkmark next to the backup name will indicate that the backup generation has been completed.
You can now either download it or navigate to the remote server to see if the backup is there:

How to restore a full cPanel backup

Note that you cannot automatically restore full cPanel backups through your cPanel interface if you have a shared or reseller account with us.
To have it restored, you will need to submit a ticket to our Hosting – Support department.

If you have a VPS or Dedicated server with root access, you can restore the full cPanel backup yourself in WHM > Restore a Full Backup/cpmove File.

NOTE: This will overwrite all the existing files, so before proceeding make sure there is nothing important left.


for cPanel x3 theme:

The Backups menu in the section Files allows you to generate/restore backups of:

  • a full cPanel account
  • a MySQL database
  • mail filters
  • mail forwarders

How to create a full cPanel backup

A full cPanel backup includes all account files, databases, email accounts and settings.
We recommend creating a full cPanel backup before any major data modification/migration.

1. Go to cPanel > Files section > Backups menu:

2. Click on Download or Generate a Full Website backup:

3. By default, a full cPanel backup will be saved into your account home directory.
Go ahead and change Backup Destination if you would like to choose another target location for the backup.

Click on Generate Backup to proceed:

4. You will see the following message notifying about the start of the backup generation process:

&

5. Click on Go Back to monitor the status of the generation process real time.

The green checkmark next to the backup name will indicate that the backup generation has been completed.
You can now either download it or navigate to the remote server to see if the backup is there:

How to restore a full cPanel backup

Note that you cannot automatically restore full cPanel backups through your cPanel interface if you have a shared or reseller account with us.
To have it restored, you will need to submit a ticket to our Hosting – Support department.

If you have a VPS or Dedicated server with root access, you can restore the full cPanel backup yourself in WHM > Restore a Full Backup/cpmove File.

NOTE: This will overwrite all the existing files, so before proceeding make sure there is nothing important left.

fullroot.png

That’s it!