Hello folks.
In this post we are going to discuss about configuration of Nextcloud with MySql . Nextcloud is a file sharing server that permits you to store your personal content like documents and pictures, in a centralized location much like Dropbox. The difference with Nextcloud is that all of its features are open-source. It also returns the control and security of your sensitive data back to you, thus eliminating the use of a third-party cloud hosting service.

MySql

Step 1 :- Installing Mysql

In order to install Mysql on your database server, switch to your root user so you can install mysql:

As you are root user, install mariadb by running:

 

During installation the root database user will be set up without a password, but an authentication plugin will prevent login from anyone but the operating system root user. A password can be set if desired.

Step 2 :- Configuring mysql
To confiqure the ‘Mysql’ we are now going to Changing the bind address in mysqld.cnf file located at /etc/mysql/mysqld.conf.d/mysqld.cnf.
It will show the following:

Edit this to change the IP to your database server.

where $IP is the IP address of the database instance.
Now this makes the database listen to connections from its IP address instead of only listening on 127.0.0.1 (the localhost).

Allowing root login from a foreign IP address :-

The database will now listen to connections from other servers but we must allow users to log in from another IP address. Do this by logging into the DB as root.

Then run the following commands to create a database named ‘nextcloud’.

 

Check to confirm the user was added and flush all privileges :

 

Now we need to  restart the mysql service so the new configs are loaded by running  command:

 

Step 3: — Installing the Nextcloud application

In this step we are going run the following commands to install Nextcloud and its dependencies.

Step 4:- Downloading Nextcloud

With the help of follownig commands we are going to download Nextcloud and change the permissions of the nextcloud directory so the web user, www-data in this case, can access it. Run the following:

 

Step 5:— Configuring Apache

In this step  we are going to configure Apache to use Nextcloud. We are going to create a file in the directory /etc/apache2/sites-available called ‘nextcloud.conf’ and add the following contents to this file:

 

Next  symlink /etc/apache2/sites-enabled/nextcloud.conf to /etc/apache2/sites-available/nextcloud.conf by running the following commands:

 

Step 6 — Finishing the Installation

Now that everything is configured on the server, open a browser and visit https://IP/nextcloud where IP is the IP address of your application instance.

Enter an admin username and password for this installation.

Next  scroll down and enter your database credentials:

The database user is ‘NgCloud_dbUser’
The password is the password you set up for that user
The database name is the name you created it is in Step#2 above
The host is the IP address of your database server with :3306 appended to the end

Click Finish Installation and you have a working installation of Nextcloud.