# Changing database from sqlite to mariadb failed

**URL:** <https://help.nextcloud.com/t/changing-database-from-sqlite-to-mariadb-failed/195944>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** github\_issue\_exists, docker, database, sqlite, mariadb\
**Created:** [June 22, 2024, 8:02pm UTC](https://help.nextcloud.com/t/changing-database-from-sqlite-to-mariadb-failed/195944 "2024-06-22T20:02:34Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jaymerts](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jaymerts/32/63411_2.png) [@jaymerts](https://help.nextcloud.com/u/jaymerts)\
**Post date:** [July 24, 2024, 3:52pm UTC](https://help.nextcloud.com/t/changing-database-from-sqlite-to-mariadb-failed/195944/3 "2024-07-24T15:52:24Z")

</div>

We can track the problem here:

> <https://github.com/nextcloud/server/issues/45257>
>
> \### ⚠️ This issue respects the following points: ⚠️
> 
> \- \[X\] This is a \*\*bug\*\*, no…t a question or a configuration/webserver/proxy issue.
> \- \[X\] This issue is \*\*not\*\* already reported on \[Github\](https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3Abug) OR \[Nextcloud Community Forum\](https://help.nextcloud.com/) \_(I've searched it)\_.
> \- \[X\] Nextcloud Server \*\*is\*\* up to date. See \[Maintenance and Release Schedule\](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
> \- \[X\] I agree to follow Nextcloud's \[Code of Conduct\](https://nextcloud.com/contribute/code-of-conduct/).
> 
> \### Bug description
> 
> The OCC-Command \`db:convert-type\` seems to ignore the DB properties (type, user, host, database, port, password) provided through the CLI and instead operates on the database configured in \`config.php\`
> 
> I believe this may be related to the commit 79c4986 as this reworked the parameter handling in \`ConnectionFactory.php\`.
> 
> If I read this correctly, the default parameters are now always generated based on the system config instead of the passed arguments.
> 
> Running \`db:convert-type --clean-schema\` drops the tables in the "old" database.
> 
> \### Steps to reproduce
> 
> 1. Have Nextcloud 29.0.0 running with a MySQL database, and an empty PostgreSQL database
> 2. run \`php occ db:convert-type --password=\<PASSWORD\> --port=5432 pgsql nextcloud\_app postgres nextcloud\` (note: the host \`postgres\` is a Kubernetes service name)
> 3. The command executes no matter if the Postgres Database is running or not, the command throws Constraint Violation errors in the table \`oc\_accounts\`, I assume because it tries to migrate the content of the old database into itself.
> 
> \### Expected behavior
> 
> \`db:convert-type\` 
> 
> \### Installation method
> 
> Community Docker image
> 
> \### Nextcloud Server version
> 
> 29
> 
> \### Operating system
> 
> Debian/Ubuntu
> 
> \### PHP engine version
> 
> None
> 
> \### Web server
> 
> None
> 
> \### Database engine version
> 
> MySQL
> 
> \### Is this bug present after an update or on a fresh install?
> 
> None
> 
> \### Are you using the Nextcloud Server Encryption module?
> 
> None
> 
> \### What user-backends are you using?
> 
> \- \[X\] Default user-backend \_(database)\_
> \- \[\] LDAP/ Active Directory
> \- \[\] SSO - SAML
> \- \[\] Other
> 
> \### Configuration report
> 
> \`\`\`shell
> {
> "system": {
> "htaccess.RewriteBase": "\\/",
> "memcache.local": "\\\\OC\\\\Memcache\\\\APCu",
> "apps\_paths": \[
> {
> "path": "\\/var\\/www\\/html\\/apps",
> "url": "\\/apps",
> "writable": false
> },
> {
> "path": "\\/var\\/www\\/html\\/custom\_apps",
> "url": "\\/custom\_apps",
> "writable": true
> }
> \],
> "instanceid": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "192.168.178.32",
> "cloud.awae.ch"
> \],
> "trusted\_proxies": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "datadirectory": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbtype": "mysql",
> "version": "29.0.0.19",
> "overwrite.cli.url": "https:\\/\\/cloud.awae.ch",
> "dbname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbhost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbport": "",
> "dbtableprefix": "oc\_",
> "mysql.utf8mb4": true,
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "installed": true,
> "overwriteprotocol": "https",
> "theme": "",
> "loglevel": 2,
> "maintenance": false,
> "mail\_smtpmode": "smtp",
> "mail\_sendmailmode": "smtp",
> "mail\_smtpauth": 1,
> "mail\_smtpauthtype": "LOGIN",
> "mail\_smtphost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpport": "25",
> "mail\_from\_address": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_domain": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtppassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpsecure": "tls",
> "default\_language": "de",
> "default\_phone\_region": "CH",
> "app\_install\_overwrite": \[
> "polls"
> \]
> }
> }
> \`\`\`
> 
> 
> \### List of activated Apps
> 
> \`\`\`shell
> Enabled:
> - activity: 2.21.1
> - circles: 29.0.0-dev
> - cloud\_federation\_api: 1.12.0
> - comments: 1.19.0
> - contactsinteraction: 1.10.0
> - dashboard: 7.9.0
> - dav: 1.30.1
> - federatedfilesharing: 1.19.0
> - federation: 1.19.0
> - files: 2.1.0
> - files\_downloadlimit: 2.0.0
> - files\_pdfviewer: 2.10.0
> - files\_reminders: 1.2.0
> - files\_sharing: 1.21.0
> - files\_trashbin: 1.19.0
> - files\_versions: 1.22.0
> - firstrunwizard: 2.18.0
> - logreader: 2.14.0
> - lookup\_server\_connector: 1.17.0
> - nextcloud\_announcements: 1.18.0
> - notes: 4.10.0
> - notifications: 2.17.0
> - oauth2: 1.17.0
> - password\_policy: 1.19.0
> - photos: 2.5.0
> - polls: 7.0.3
> - privacy: 1.13.0
> - provisioning\_api: 1.19.0
> - recommendations: 2.1.0
> - related\_resources: 1.4.0
> - serverinfo: 1.19.0
> - settings: 1.12.0
> - sharebymail: 1.19.0
> - support: 1.12.0
> - survey\_client: 1.17.0
> - systemtags: 1.19.0
> - text: 3.10.0
> - theming: 2.4.0
> - twofactor\_backupcodes: 1.18.0
> - updatenotification: 1.19.1
> - viewer: 2.3.0
> - workflowengine: 2.11.0
> Disabled:
> - admin\_audit: 1.19.0
> - bruteforcesettings: 2.9.0 (installed 2.4.0)
> - encryption: 2.17.0
> - extract: 1.3.6 (installed 1.3.6)
> - files\_external: 1.21.0
> - files\_rightclick: 0.15.1 (installed 1.6.0)
> - maps: 1.1.0 (installed 1.1.0)
> - suspicious\_login: 7.0.0
> - twofactor\_totp: 11.0.0-dev
> - user\_ldap: 1.20.0
> - user\_status: 1.9.0 (installed 1.4.0)
> - weather\_status: 1.9.0 (installed 1.4.0)
> \`\`\`
> 
> 
> \### Nextcloud Signing status
> 
> \`\`\`shell
> No errors have been found.
> \`\`\`
> 
> 
> \### Nextcloud Logs
> 
> \_No response\_
> 
> \### Additional info
> 
> \* Docker Image: \`nextcloud:29.0.0\`
> \* MySQL Database: \`mysql:8.4.0\`
> \* Postgres Databse: \`postgres:16.3\`

---

_[View the full topic](https://help.nextcloud.com/t/changing-database-from-sqlite-to-mariadb-failed/195944)._
