How to move databases between subscriptions in Plesk

- by

You can move databases and database users between subscriptions in Plesk. There’s no web interface for this, but with a bit of manual database tweaking you’ll soon get the hang of it.

I recently split a subscription into two for a client and this trick came in handy.

Before we begin, make sure you backup the psa database – that’s what Plesk uses to keep track of internal values, anything from user names, passwords, and which service is associated with what. If you ruin psa you’ll ruin your Plesk installation. Use caution!

Editing psa

You can use phpMyAdmin from Plesk to edit the psa database. Head over to Tools and Settings (or the Server Tab), Database Servers and click the little wrench icon. This will open phpMyAdmin in a new window.

Screen Shot 2014-12-04 at 11.34.02

Find the psa database and click on the little disclosure plus icon. This will show you all its tables, similar to this:

Screen Shot 2014-12-04 at 11.37.24

Scroll down to find data_bases and db_users. Open either of them (with the little disclose icon again) and you’ll find a list of databases and users respectively. Note the column dom_id. This is how Plesk knows which subscription (or domain) this database belongs to. MySQL takes care of the actual database, the value here is for visual representations in Plesk only.

The difficult bit is to find out which numeric dom_id translates into which domain. There’s not an easy way to extract that info from Plesk, so we’ll use a quick workaround: create a new identifiable database (and user) in the subscription we’d like to move to and simply look at which dom_id it gets.

Creating a Dummy Database

Back in Plesk, head over to the subscription you’d like to move your database to and create a memorable user/database combo. Anything will do, we’ll delete this later. Call it “aaaaaaaaa” or “comehere” – up to you.

Once done, head back over to psa database in phpMyAdmin, refresh and look at the data_bases (and db_users) again. You’ll see something like this:

Screen Shot 2014-12-04 at 11.50.55

Now we know that our important_database (and important_user) need a dom_id value of 2 instead of 1. Change it in both tables – and you’re done!

Head back into Plesk and check your subscriptions: the database and user will have disappeared from subscription 1 and will now appear in subscription 2.

Thanks to Matt Nelson for this tip!

If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

2 thoughts on “How to move databases between subscriptions in Plesk”

  1. Thanks for help been looking for this since upgrading 11 to 12. BUT when I did above I could not access the copied database via phpMyadmin on the domain I copied database. I got a loop error. When I tried to simply copy the new database I got error that I couldn’t. I wondered if it was due to permissions in the database still linking to the domain it was copied from?

  2. Hi Paul, I’m afraid I’ve never encountered this problem before – I’m not sure what to make of it. If Plesk gives you any trouble, you can simply read out the database and recreate it manually under a different subscription. It’s more work, but at least that way Plesk does not complain.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.