Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update instructions and add a caveat about TCP on Linux

...

It is recommended that your version of MySQL is compatible with the version of the OpenMRS Platform you are installing.

  • OpenMRS Platform version 2.2 and below requires MySQL 5.6 supports
  • OpenMRS Platform version 2.2 3 and belowabove support MySQL 5.7 supports
  • OpenMRS Platform version 2.3 4 and above support MySQL 8

This requires installing an older version than the latest MySQL release.

...

  • The MySQL installer for Windows is found here
    • Click "Looking for previous GA versions?" to install version 5.6 or 5.7
    • For other versions, click "Archives"
  • Run Download and run the installer program (.msi)
  • Accept the license agreement
  • When given the option to update installer please do so
  • Under Feature Selection select Full Installation Setup and select the right Architecture for your computer (32-bit / 64-bit)
  • Click next and you will be shown a list of applications that you need in order to meet the requirements for installing all services. Make sure you satisfy all the requirements, if not, please install the missing applications on your machine.
  • On the next configuration options select “Developer Machine”
  • Leave all other settings to default
  • Enter a username and password. Note: These are the credentials for the user with root privileges. Do not forget this password.
  • Click next and finish the installation.

...

To install an older version such as MySQL 5.6 or 5.7 (recommended), follow the instructions laid out here.

To install the latest package, perform the following.

  1. Install the MySQL server package as root:

    Code Block
    languagebash
    sudo apt-get install mysql-server


  2. Enter a root password

Note that with many Linux distributions, the default install of MySQL might not be accessible to OpenMRS. To ensure your instance of MySQL will work with OpenMRS, you can use the following command:

Code Block
languagebash
mysql -h localhost -P 3306 --protocol tcp -u root -p

This will prompt you for the root password you selected above. if you cannot connect like this, you'll need to ensure that the root MySQL user is able to login via TCP. To do this run:

Code Block
languagebash
sudo mysql -u root
mysql> use mysql;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
mysql> FLUSH PRIVILEGES;
mysql> exit


Docker

Docker allows easy installation of MySQL in a self-contained container on linux but is a bit more complicated option on Windows or OSX. See https://docs.docker.com/engine/installation/ on how to start using Docker.

After you have installed Docker, it's easy to launch a MySQL container. This will download a MySQL 5.7 Docker image and run it:

Code Block
languagebash
$ sudo docker run --name openmrs-mysql57mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=openmrs -d mysql:5.7

...

You may also ask Docker to list all Docker containers:

Code Block
languagebash
$ sudo docker ps --all
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
233f1d85e7c9        mysql:5.7           "/entrypoint.sh mysql"   20 seconds ago      Up 19 seconds       0.0.0.0:3306->3306/tcp   openmrs-mysql57mysql

Need to test on another MySQL version? You may run multiple MySQL container's simultaneously just as long as you give them unique names and port mappings. For example to run a MySQL 5.7 container, you might say:

Code Block
languagebash
$ sudo docker run --name openmrs-mysql57mysql -p 3316:3306 -e MYSQL_ROOT_PASSWORD=openmrs -d mysql:5.7

...

Code Block
languagebash
# stopping...
$ sudo docker stop openmrs-mysql57mysql

# ...and starting again
$ sudo docker start openmrs-mysql57mysql

If you decide you don't need the database any more you can remove it:

Code Block
languagebash
$ sudo docker rm openmrs-mysql57

...

mysql