How to Import Database Copy Into New Database Using SSH

Here’s the SSH command to import a database backup to a new database.

Navigate to the directory where your database copy resides using SSH.

mysql -uusername -p databasename < backupname.sql

You’ll be prompted for the password for the database. Enter that.

If this is a Magento database, it could take awhile to import. Ours is around 600M, so it took awhile.

That’s it.

How To Make Backup of MySQL Database Using SSH

Part of the transfer or migration of a website many times involves a database. If you are on an “ix” server, SSH is a great way to backup your MySQL database.

Here’s how you do it:

Using SSH, navigate to your httpdocs or public folder on your server where the website resides.

Use the following command.

mysqldump –opt -Q -u dbusername -p databasename > /path/to/backupname.sql

This creates a copy of your database.

Now, you can transfer that database backup to your new server.

How to Transfer (Migrate) a Complete Site From One Server to Another

If you ever have a need to migrate a website from one server to another, it can be a huge deal, especially when dealing with Magento, which has tens of thousands of files. Also, if your Magento store has many products, you have all those thousands of image files to move too. You could try FTP, but usually our servers hang during a large transfer. Even if you could do it by FTP, it would take hours at best to transfer a complete Magento site.

So here’s how to do a complete site migration using SSH. This can be used for any website you have root access to, not just a Magento site.

1. Login to server 1 via SSH and open the folder which you want to backup. You’ll probably need to login as root user.

Use this commands:

cd /home/somepath/to/yourwebsite/public_html

2. Make a compressed archive out of this folder using the command

Next:

tar -cvf sitepack.tar ./

3. Login to server 2 via SSH and use the command below to fetch the backup from server

wget yourdomain.com/sitepack.tar

4. Now uncompress the archive using the command

tar -xvf sitepack.tar

This is the easiest way we know of to move large websites with tons of files.

Fatal Error – Maximum Execution Time Exceeded

How to fix the error of maximum execution time exceeded or memory limit.

in your htaccess file put in this:

php_value memory_limit 256M

php_value max_execution_time 36000

You can even go up from there