Moving WordPress Wocommerce site on new Vps server

Moving WordPress:

– make backup ow wordpress site, for backup I use BackUpWordPress from Human Made Limited.

For unmanaged VPS server use putty.
host name = ip address, usually use port 22,  type root, and password.
Login to MySql:

mysql -u root -p

Create Database on new server:


Create User:

CREATE USER 'custom_user'@'localhost'IDENTIFIED BY 'password';

Grant User rights in two ways:

GRANT SELECT, INSERT UPDATE, DELETE, CREATE, DROP ON name_database.* TO 'custom_user'@'localhost';
GRANT ALL PRIEVILEGES ON my_database.* TO 'my_user'@'localhost' WITH GRANT OPTION;

check this:

SHOW GRANTS FOR 'admin'@'localhost'

and exit mysql just type exit 

If you use BackUpWordPress from Human Made Limited in you zip file is copy yours database “filename.sql”

Upload this file on new server via ftp
import this database:

mysql -u user_name -p database_name < /var/uploaded_database_directory

Check this:

mysql -u root -p
use database_name;
show tables;

if everything looks ok just type exit
If don’t import correctly, or need to be imported again.

Delete all tables in database:

SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') 
FROM information_schema.tables 
WHERE table_schema = 'database_name';

Before upload backup file to the new server

Zip file created by BackUpWordPress from Human Made Limited need to be uploaded on new serwer and unpacked
if domain, or location on serwer also will change two files need to be updated:

wp-config.php – on bottom of this file


function.php – on top of this file
Please note:
– Always Create own function.php file in child theme directory.
– Always create child themes even don’t plan make any customization to the word-press template, just in case if I need make any changes in the future.


If database name, database user name, and database password was changed, in wp-config.php file change:

/** The name of the database for WordPress */
define('DB_NAME', 'new_name');

/** MySQL database username */
define('DB_USER', 'new_user_name');

/** MySQL database password */
define('DB_PASSWORD', 'new_password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Working With Unix Creating Folders and Permissions.

Now on the serwer using putty command line:
(most command in command line use flags like -R for recursive, for get to know what all mining just type: man command_name (man useradd)

Simply navigation:

cd /var/www/my_folder/

List file in folder wit all info:

ls -la

add user:

useradd -m name_user

Add password for user:

passwd name_user

Check to what group belongs user:

groups name_user

Add user to the group, use the following command:

usermod -a -G group_name user_name
usermod -a -G www-data user_name

Add perrmision to the group:

chmod -R g+rwx file_name

Change Ownership to the server:

chown www-data file_name
chown -R www-data *  (-R Recursively all fie doesn't include file like .htaccess )
chown -R www-data ./ (will work, on .htaccess)

Change group file ownership:

chgrp -R name_group www-data file_name
// -R recursive, instead of file_name use wild card * -> chgrp -R www-data *
// this change all files in actual directory

create folder:

 mkdir name_folder


cp -av source/* dest/


rm -rf directory_name -f 
// f for force




Leave a Reply

Your email address will not be published. Required fields are marked *