Server Settings

This page describes appropriate server connection settings.

Connection to Server Settings:

Proper configuration settings: Occasionally, you might encounter this “connection to server issue” on the community app when attempting to log in. From my experience, this usually occurs when there is an issue with the database or when Fineract 1. x cannot establish a proper connection with the database or make queries accordingly. I’ve tried to document as many potential causes and how to solve them.

a. MySQL Packet Size Issue:

Possible Causes:

In runtime, Fineract 1. x’s database got a packet(size of data sent from the backend to MySQL database for a specific query) that was bigger than the maximum allowed. As a result, a community app(front-end Mifos X web client) user could not log in. The user finds “Connection to server error”. This happens because the maximum allowed packet value permitted by the MySQL server is 4MB by default. This is too small to handle specific queries.

Possible Occurrence:

I once encountered this while trying to log into Fineract 1. x via the Community App; you probably will, too. There might be other requests made that cause this issue to pop up, but whatever the case, possible resolutions are defined below.

Solution Path:

You will have to increase the maximum allowed packet value for the MySQL database to 67MB or more if the server is required to handle more significant queries.

  1. Option 1 (preferred): log in to MySQL and change the “max_allowed_packet” for every user to 67MB (67108864 bytes) until the server restarts. This value can be increased up to 1GB but will reset if the MySQL server restarts, even if you set it globally.

  1. Option 2

a. Remove the MySQL docker container. Note that doing so will delete all databases in that container.

b. Create a new container, passing the following flag “–max-allowed-packet=67108864”


b. MySQL User Denied Access:

Existing user access is not possible. Connection to server error:

Cause 1: Unable to log in to MySQL server:

On checking the logs (see previous blog), the following error was shown: Access denied for user root@172.17.0.1 (using password: YES).

Possible Reasons:

Initially and by default, Fineract 1. x is connected to the default tenant database on the MySQL server using a user “root” with schema server “localhost“. Details of these tenant connection parameters can be found in the fineract_tenants.tenant_server_connection table.

Possible Occurrence:

The error you see above indicates that the application was trying to connect to a user “root“ with hostname “172.17.0.1“, which wasn’t available. Trying to log in via phpmyadmin shows the same error – as below:

Solution Path:

After logging in with an existing user on the MySQL server, create a new user “root“ with hostname “172.17.0.1“:

  • Create user

where “some_password“ is the root user’s password.

  • Grant all privileges to new user

  • Implement changes

Note:

A new user can easily be created and granted all the required privileges using the same MySQL management GUI tool, e.g., phpMyAdmin.


Cause 2: phpMyAdmin data loss

Possible Reasons:

A malicious user could have deleted your databases. Precautions can be taken to avoid this situation, such as disabling root access and making regular backups.

Possible Occurrence:

On a public deployment, using common credentials like a root user to access the database or using a weak password can make your database liable to attack, and it could get deleted, too!

Solution Path: Disabling root access for security purposes

This can be done by creating an entirely new user, granting all privileges, and then deleting the root user. The default username and password are “root” and “MySQL” respectively. My advice is to decide on a solid, safe password (16 characters preferably) for the new user to be created before proceeding.

To modify user access credentials, please follow these steps:

  1. Login to MySQL via the terminal or PHPMyAdmin

  2. Add a new user – Pick a new username/password, assign full privileges globally, and then create the user.

  3. Go to the fineract_tenants>tenant_server_connections table and make the following changes:

  • Replace the value of the schema_username and schema_password columns with the username and password of the new user which you just created, respectively.

  1. Go to the “jdbc.properties” file in the codebase and change the values of:

  • fineract_tenants_uid to the new user’s username

  • fineract_tenants_password to the new user’s password.

Related Documentation

Note: Appendix A – To change mysql username/password

Last updated

Logo

Maintained by © Muellners Foundation. All Rights Reserved.