Migrate magento to new server / domain / database / host
Move or migrate magento to new server, domain, database, host, anything by following the steps below.
To configure your Magento with a new domain, you will need to do following steps:
– Copy whole Magento project from current server and paste it to the new server.
You can do server-to-server transfer. First, tar.gz your magento project
tar -cvf magento.tar.gz magento
Then copy it to your new server from old server
scp magento.tar.gz root@your.ip.address.here:/var/www/.
– Backup the database (Admin -> System -> Tools -> Backup)
You can also take backup through phpMyAdmin, or by mysql.
mysqldump -u user -p database > /path/to/keep/db.sql
– Logout from your old server. Login to new server.
Extract the file magento.tar.gz that you sent from old server
tar -zxvf magento.tar.gz
– Delete all directory or files that are there in cache folder
rm -rf var/cache/*
– Edit local.xml that is in magento/app/etc/local.xml and change mysql username, password, database as per new server credentials
– Import the backed up database. Before that create empty database to dump tables in it.
mysql -u root -p 'password';
create database dbname;
exit;
mysql -u root -p -d dbname < /path/to/your/db.sql
- Edit the database to change it to your new domain name. Search in core_config_data table for old domain.
select * from core_config_data where path like '%secure/base_url';
and update it with your new domain
update core_config_data set value='http://mysite.com/' where path like '%secure/base_url';
5 Comments
Leave a comment
Welcome to my Blog
Certifications
Honor
Recognition
Contributions
Categories
- Apache (2)
- ChatGPT (1)
- Domain name (2)
- eCommerce (2)
- htaccess (1)
- Humor (3)
- Instagram API (1)
- jQuery (4)
- JSON (1)
- Linux (10)
- Magento (142)
- Magento admin (58)
- Magento Certification (5)
- Magento error (13)
- Magento frontend (68)
- Magento Imagine (2)
- Magento Interview (5)
- Magento Master (2)
- Magento2 (10)
- Mobile (1)
- MySQL (7)
- OpenAI (1)
- OroCRM (2)
- Performance (2)
- PHP (8)
- Prototype JS (3)
- Security (4)
- Wordpress (3)
- XML (2)
Hi
Thanks for your posting, it’s been a great help.
Although i’m having an issue trying to transfer via scp the tar.gz file.
I’ve tried this two options
Option 1: Logged at Old Server via SSH
scp magento.tar.gz root@IPADDRESS:/var/www/.
The error in this case is
/usr/bin/ssh: no such file or directory
Option 2: Logged at new server via SSH
scp OLDUSER@OLDURL:/var/forojardin.com.ar/htdocs/magento.tar.gz /var/www/
The error in this case is
ssh: connect to host forojardin.com.ar port 22: Connection refused
Do you know what could be the problem?
Thank you
Hi Esteban, the error is because SSH is not installed in your system. Make sure both the machines have SSH. SCP uses SSH to transfer files between servers. In Ubuntu we generally do with sudo apt-get install openssh-server to install OpenSSH.
I guess you’re right. In OLDSERVER i think openssh it’s not installed.
The problem is that i don’t have root access in that server. Only SSH access to manage files, etc but i cannot install anything.
Is there another way to transfer the file? Becasue it’s 1,5GB
Thank you so much for your response
Try with FTP
Great tutorial! Very Helpful, thanks