Switching between postgres databases

[details=“Support intro”]

Nextcloud v15
Platform: Kubernetes Digital Ocean
Web server: Nginx
PHP version:

I have a nextcloud installation running on Digital Ocean Kubernetes. I have dedicated containers for each of the nextcloud components running in their own pods or shared : nextcloud(php), a rproxy(nginx), redis, postgresql. The storage is in Spaces(blob storage) and the database is running on postgres in a pod. It’s been running smoothly for over a year now.

Now, I’d like to migrate my database to the Digital Ocean managed postgres. I’ve migrated my database there without issues. The only step I’m missing is switching my config from the current database to the managed database. My current config looks like:

  'dbtype' => 'pgsql',                           
  'dbname' => 'myDB',           
  'dbhost' => 'myPOD',                                                                                            
  'dbport' => '',                               
  'dbtableprefix' => 'oc_',                                                                                       
  'dbuser' => 'oc_postgres',  
  'dbpassword' => 'some_salted_password',       [edited see comment below]                                                        

Whtat’s the best way to switch the database configuration? Is there an specific nextcloud command?. Also, how can I encrypt the dbpassword variable with my new value?

Hi clvx,

I’m very new to nextcloud. But in the Administrator manual, you can find everything you need about postgresql database in basically:


As you have an existing installation with mysql database and files, in the data directory, you want to export your mysql
via sql dump and import this into your new postgresql database. Installation hints in the manual above.
Second part are the data directory and third the html and php site.
Keep in mind, you will need postgresql support in php. You find this also in the manual.

I’m installed nextcloud with postgresql database from the ground. I don’t migrade from mysql to postgresql, and it works fine. Hopefully this helps you.


PS: Also take a look here:

I made some progress. I think the issue is the password which is not salted. I also figured out sslmode=require is mandatory according to Digital Ocean documentation. This helped me to configure it.

When I check dbpassword in config.php I see a string which is not the password I defined in my nextcloud configmap pod to communicate to my database in the postgres pod . So, this makes me wonder if I have to salt the digital ocean postgres password as a value for dbpassword. If yes, how would I do that?.
For my particular case, I switched the password in DO postgres to my previous password; hence, in theory the salted password shouldn’t be an issue at all now but I’m still getting a timeout when I try to connect.

I also asked this in the Digital Ocean Q&A if someone wants to chime in: https://www.digitalocean.com/community/questions/nextcloud-cannot-connect-to-digital-ocean-postgresql

Found the error. To connect to Digital Ocean Postgres you need to set 'dbhost' => 'hostname:port' and comment out //dbport=> ‘’`.

sslmode=require is not needed.

I have the exact same issue… I tried to set port & sslmode in the host, but this is not working for me.

Not supporting SSL is a major issue IMO. Does someone has a solution? May be a contribution is needed to improve support of SSL with PDO/pgsl.

commenting out //dbport=> ‘’` is useless since dbport default value is a empty string.