Migrating (Converting) from SQLite to MariaDB in Nextcloud

2 min

language: ja bn en es hi pt ru zh-cn zh-tw

Hello, I'm incompetent.

I finally got around to migrating Nextcloud from SQLite, which I had always intended to be temporary, to MariaDB, so I'm making a note of it.

As a prerequisite, assume that MariaDB is already installed.


First, enter MariaDB.

mysql -u root -p

Create a database.

create database nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
grant all on nextcloud.* to 'nc_user'@'localhost' identified by 'PASSWORD';
flush privileges;

Then exit.

exit

Next, perform the conversion for migration in Nextcloud.

cd /var/www/html/nextcloud
sudo -u www-data php occ db:convert-type --all-apps mysql nc_user localhost nextcloud

Also, change the character encoding.

sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
sudo -u www-data php occ maintenance:repair
sudo -u www-data php occ maintenance:mode --off

Voila! Just like that, the conversion is complete, and you can migrate to MariaDB.

It feels like it got a bit faster...
Since many of my servers run on MariaDB, I did this to consolidate things to some extent.

That's it!

Related Posts