Issues: Migrate from "self host" to "shared host" (db conflict)

My home server will be offline for quite some time. As a result, I’ve decided to migrate my Nextcloud to a shared hosting server.

Everything is straight-forward except for the database migration. Specifically, dumping the current db is not an issue but restoring it to the new server seems to be problematic:

  • my hosting provider forces me to prepend my existing Nextcloud user name and database name with my hosting account user name. These are not the same as those in my current configuration. Furthermore, my existing Nextcloud server name is “localhost”; I cannot use this on the new server. Due to these naming conflicts, it seems that I will be prevented from importing (restoring) my database into the new server.

I’m at a loss as to how I should proceed. Is there some MySQL (MariaDB) “magic” available to help me overcome what I perceive to be a road block in my need to migrate?

I think it would be helpful to know if you’re trying to migrate the same Nextcloud version, which MariaDB version you are exactly using, if it is a shared or dedicated database, how you’re accessing the database and what the PRECISE error message is which is being displayed.

@j-ed ,

  • I’m currently running Nextcloud 21.0.1
    • I’ll install the same on the new server
  • mysql 10.4.18
  • dedicated database
  • “how you’re accessing the database” ?? I’m accessing it through Nextcloud!
  • there is no error message yet! If I can restore the dump within the constraints as I had outlined in my OP, I’m sure that there will be some variation of “the database can’t be accessed”.

I don’t see the problem here. Just change the values in your config.php to match whatever you end up with after the migration.

Please bear with me; perhaps I’m making more out of this than is necessary…

  • Will I not encounter problems when the User of dumped database has a different name than the User of the new database when I attempt to import the former?

You are definitely making this over complicated.

On your self-host;
mysqldump -u olddbuser -p olddbname > nextcloud.sql

On your shared host;
mysql -u newdbuser -p newdbname < nextcloud.sql

1 Like

This is certainly a relief. Many thanks, @Larry_Boyd