User Tools

Site Tools


Install FreeHealth EHR in server mode

The only supported database for FreeHealth EHR is MariaDB.

In the following guide, all references to “MySQL” shoud be considered to mean “MariaDB”.

The easiest way to try FreeHealth with MariaDB is to install MariaDB on your own laptop or PC: FreeHealth EHR and MariaDB will run on the same machine. This installation guide will cover this basic installation.

For real world professional usage with multiple users and workstations, you should run MariaDB on its own GNU/Linux server. Setting up a network for your healthcare facility is beyond the scope of this installation guide. You can contact one of our recommended partners to help you with this task.

Step 1: Download and install MariaDB

GNU Linux

Instructions for Ubuntu 16.04 or higher & Debian 9

sudo apt-get install mariadb-server mariadb-client
sudo mysql -u root

You will use MariaDB user 'freehealth' and its password 'MyPassWord' to install the EHR.

Test by entering this in a terminal:

# note: we are NOT using sudo, this must work with a normal (non root) user, without using sudo
mysql -u freehealth -h -pMyPassWord

It should allow you to connect to MariaDB server:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

If you encounter problems, try to delete mariadb-server or mysql-server completely (use a search engine to learn how to do it, removing the package is not enough even with purge option), reboot and try again. If you still can't get user 'freehealth' to connect to MariaDB server with a password (without sudo or a root user), you should consider getting professional help to install the database.

Step 2: installation of FreeHealth EHR in server mode

Start the FreeHealth installer

  1. Start FreeHealth EHR
  2. The configurator will ask you to choose how to install Freehealth EHR
  3. Select “Create MariaDB databases” in the drop-down list
Troubleshooting: if you don't see the following configurator window, it probably means FreeHealth was previously installed on your machine and there are some leftover files and folders. See Uninstall applications to learn how to remove them completely.
 Select "Create MySQL databases (it is the default selection)" in the drop-down list Select “Create MariaDB databases (it is the default selection)” in the drop-down list
 Network configuration for MySQL server Network configuration for MySQL server
  1. Set the parameters of the host:
    • Server type: MySQL
    • Hostname: (or the ip address or hostname of the server if it is installed on another computer)
    • Port: 3306
  2. Test the connection to the host
  3. If the MySQL server can be reached by FreeHealth EHR, “Host available…” will be printed
  4. Fill in MySQL server root user credentials:
    • Login: freehealth (don't use root as in the picture)
    • Password: the one you entered when you created the user freehealth
  5. Test the connection to database server
  6. If the connection is possible with the login and password you entered, a green check mark will appear before Test connection: “ ✓ Test connection”
  7. Click on Continue

MariaDB server setup is done.


Connection error

Most connection errors are not related to a bug in the EHR. An error message is displayed in a textbox to help you fix the problem. If you are using version 0.11 or higher, detailed information is available in a log file created inside your home or user folder for each connection error. The filename start with EHR_log_ followed by a date and time stamp. The file type is .txt A typical log file will be named


Please check if you can connect to your database with the mysql client before asking for help on the forum. The user should be freehealth or equivalent to root and be able to read the mysql database:

SELECT User FROM mysql.user;

I can't connect to the server from another machine in the network

Is MariaDB server up and running?

  systemctl status mariadb.service
  ● mariadb.service - MariaDB database server
 Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
 Active: active (running) since Sat 2017-08-05 21:23:16 CEST; 2min 52s ago

If you see “active (running)”, it is up and running.

bind-address in my.cnf

In /etc/mysql/my.cnf

If you set 'bind-address' to '::' MariaDB will accept IPv4 and IPv6 connections from the network (both Local Area Network and Wide Area Network aka Internet).

  bind-address = ::


If my.cnf is set correctly and you still cannot connect, it could be the firewall. Some VPS providers and/or some GNU/Linux distributions install a firewall by default.


UFW aka Uncomplicated Firewall comes by default with Ubuntu. Allow tcp traffic on port 3306:

  ufw allow 3306/tcp
  service ufw restart
  systemctl restart mariadb.service

Debian comes with IPTables configured to allow all traffic, but someone or something could have changed the rules since installation.

Check your iptables rules:

  iptables --list
  iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
  systemctl restart mariadb.service

Previous MySQL installation

Remnants of previous MySQL installation are known to cause problems.

If you encounter problems, try to delete any previous installation of mysql-server completely (use a search engine to learn how to do it, removing the package is not enough even with purge option, you need to delete a collection of system files), reboot and try again.

How to delete EHR data from the server

en/manuals/ehr/install/mariadb.txt · Last modified: 2018/03/13 15:55 by Jérôme Pinguet