How to migrate local database between Plesk servers manually


2016-11-16 13:08:04 UTC


2017-06-14 07:32:07 UTC


Was this article helpful?

Have more questions?

Submit a request

How to migrate local database between Plesk servers manually

Applicable to:

  • Plesk for Linux


How to migrate local database between Plesk servers manually?


Local databases are databases that are created through Plesk on a local MySQL server. This is the default database server used by Plesk.

Using the instructions below, it is possible to migrate a local MySQL database between Plesk servers manually.

  1. On the source server, get information about the local databases on the created domain, :

    source ~# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa
    mysql> select as domain, as db_name, dbu.login, a.password from domains d, data_bases db, db_users dbu, accounts a where and and and'';
    | domain      | db_name       | login        | password       |
    1 row in set (0.01 sec)
  2. On the source server, back up the database. You may use the following command:

    source ~# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin DATADASE_NAME > DATADASE_NAME.dump
  3. Move the dump to the destination server.

  4. On the destination server, create the database DATADASE_NAME on the domain with Plesk CLI /usr/local/psa/bin/database . Assign the same username and password as on the source:
    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 utility /usr/local/psa/bin/database will update the Plesk database with the appropriate username and password . Run the utility with --help option to get a list of all available options. After creation, it is possible to log in to the database through DB WebAdmin in Plesk on the destination server: Home > Domains > > Databases > DATADASE_NAME > DB WebAdmin

  5. On the destination server, restore the content of the database from the dump created on the source server:
    destination ~# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin DATADASE_NAME < DATADASE_NAME.dump ``
Have more questions? Submit a request
Please sign in to leave a comment.