MariaDB Database gone after installing MySQL

Nextcloud version (25.0.4):
Operating system and version (Ubuntu 22.04.2 32-bit on Raspberry Pi 4b):
Apache or nginx version (Apache 2.4.25):
PHP version (8.1):

Hello there people,
sadly I was a bit… foolish … I’d say. I simply followed the install suggestion by Ubuntu for Wordpress and with that automatically uninstalled mariadb (because it was installing MySQL).
This results in my page not beeing available at all.

So my question is: How do I create a new database and connect/index it to all data I’ve got on my previous storage?
Or can i simply reconnect the still existing database information located in /var/lib/mysql?

If needed, I’ll get you all the information required. Thanks for all the answers in advance!


I don’t think it’s possible to simply repopulate a deleted database. It stores a lot of critical system info that isn’t stored in files (for example shares).

If restoring from your backup isn’t possible for whatever reason, I think you will basically be looking at a new installation and then adding your files back.

Or maybe the old MariaDB data is still on disk? Did you try switching back?

1 Like

Hey Karl,
thank’s for your response! I was simply to afraid to try something myself. The solution was absolutely easy tho!

The data of the database was still existing in /var/lib/mysql/nextcloud. Since Ubuntu/APT want’s to uninstall the one or the other, if one DB-Server is running, I simply reinstalled the package mariadb-server.
One sudo apt install mariadb-server later … et voilà … Nextcloud is up and running again.

1 Like