Nextcloud Database Migration from SQLite to Mariadb

Hey, I have a linuxserver/nextcloud instance with SQLite. Now, I want to migrate the database to MariaDB. I have MariaDB installed locally on Ubuntu (mainly so I can create multiple databases)

I based into the docker container as UID 1000. went to /data/config/www/nextcloud and pasted the following command as per nextcloud docs.

php occ db:convert-type --all-apps mysql db_user db_name

Then entered password as per prompt. However I get the following error

“Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused”

I tried changing the hostname to localhost (according to by database user) and still facing the same problem.