Linux – Network – Technology
Posts tagged db
Plesk – Migrate DB
Oct 26th
On source server backup the database. You may use the following command:
source ~# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` DATADASE_NAME > DATADASE_NAME.dump
On destination server create database DATADASE_NAME on domain DOMAIN.NAME with Plesk CLI /usr/local/psa/bin/database. Assign the same user and password:
destination ~# /usr/local/psa/bin/database --create DATADASE_NAME -domain DOMAIN.NAME -type mysql -passwd DB_USER_PASSWD -passwd_type plain -add_user DB_USER_NAME -server localhost
Database creation through Plesk CLI /usr/local/psa/bin/database will update Plesk database with appropriate user and password correctly. Run the utility wit “–help” to get list of all available options. After creation it is possible to login to the database through DB WebAdmin in Parallels Plesk Panel on destination server: Domains -> DOMAIN.NAME -> Databases -> DATADASE_NAME -> DB WebAdmin
On destination server restore content of the database from the dump created on source server:
destination ~# mysql -uadmin -p`cat /etc/psa/.psa.shadow` DATADASE_NAME < DATADASE_NAME.dump