Showing posts with label Server. Show all posts
Showing posts with label Server. Show all posts

March 15, 2007

Website Shifting (All files & DataBase)

Here is the method for Shifting your website & database from one server to another with simple steps. This works only on Linux server.

Steps to follow on Existing(Source) Server:
1. Move in the root folder of project i.e. change the directory
cd /path/to/dir

2. Compress the website(project) folder
tar -cvf xxxx.tar * (Supposing 'xxxx' is the name of project)

3. Export the Database in a tar file
mysqldump dbName -u dbUserName -p > dbFileName.tar
Password: myPassword

example:
mysqldump xxxx -u root -p > xxxx_DB_Backup.tar
Password: password

4. Copy the tar files to New server, where you want to shift (move) the website
scp xxxx.tar RemoteUserName@RemoteIP:/path/to/dir/xxxx.tar
Password: (password for that user of Remote IP)

example:
scp xxxx.tar root@127.0.0.1:/home/xyz/public_html/xxxx.tar
Password: myRootPassword

scp xxxx_DB_Backup.tar root@127.0.0.1:/home/xyz/public_html/xxxx_DB_Backup.tar
Password: myRootPassword

Steps to follow onNew(Target) Server:
1. Move in the root folder of project, where you have copied the compressed file
cd /path/to/dir

2. UnTar the tar file
tar -xvf xxxx.tar

3. Import the Database
mysql myDbName -u
dbUserName -p < dbFileName.tar
Password: myPassword