How to change the database from mysql to postgresql?

I have tried to change the database useing command “sudo -u www-data php occ db:convert-type --all-apps pgsql nextcloud1 nextcloud1” .After I finished it, I cannot open my webgui ! It’s said in the log: image

You haven’t given much information to go on (OS, PHP version, etc).
But anyhow, probably you don’t have the postgresql module for php installed.

If you are on debian, you could run:
php -i | grep -i sql
In the output there should be something like:
PDO Driver for PostgreSQL => enabled
If not, you are missing the package, you can check that with:
apt-cache policy php7.0-pgsql
(the exact package depends on your OS)
If it’s not installed, you can do that with apt-get install

Assuming you have a backup from a working state you should roll back to that , install the extra package and run the migration command again.

I’m sorry for the missing information:

Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial

PHP 7.0.30-0ubuntu0.16.04.1 (cli) ( NTS )
And PostgreSQL:

I suppose that if I shoud install some other modules for nextcloud ? If so, how to do that?

Thankyou a lot!