Nextcloud works ‘out of the box’ with SQLite as a database.
That is fine if your Cloud has few users. I have opted for an RDBMS. Ihave chosen MariaDB. The advantage is that MariaDB is Open Source and will remain (as opposed to MySQL). However, if you want to use a graphical tool to manage the database (s) from the Raspberry pi then that is not possible. None of the existing tooling for MariaDB works on the Raspberry Pi. (Maybe that is different for MySQL but I have not tried that.)
Install MariasDB as follows: sudo apt-get install mariadb server
Of course you want to put the database data on the Raid drive. Log in to MariaDB with command: sudo mysql -u root
(You do not have to enter a password because the root user is linked to the Linux user via the unix-socket plugin; you can check this with SQL: select host, user, plugin from mysql.user;)
Then type: select @@ datadir; This shows you the current location of the database; (/var/lib/mysql).
- Stop MariaDB with command: sudo service mysql stop
- Copy the database with command: sudo rsync -av /var/lib/mysql /mnt/raiddrive
- Modify file /etc/mysql/mariadb.conf.d/50-server.cnf: change the datadir location to /mnt/raiddrive/mysql; ( datadir = /mnt/raiddrive/mysql ).
- Start MariaDB: sudo service myslq start
Log in to MariaDB with command: sudo mysql -u root and then create the database that you will use for Nextcloud.
- CREATE USER ‘<nextclouduser>’@’localhost’ IDENTIFIED BY ‘<password>’
- CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
- GRANT ALL PRIVILEGES on nextcloud.* to ‘<nextclouduser>’@’localhost’;
- FLUSH privileges;
Close the mysql session withcommand: quit
For Nextcloud you also need to modify file /etc/mysql/mariadb.conf.d/50-server.cnf again. Put the following lines somewhere after the [mysqld] header:
transaction_isolation = READ-COMMITTED
binlog_format = ROW
Then restart the database: sudo service mysql restart
Previous pageNext page