Step 3 Problem Installing OpenEMR 5.0.1 on Hosted Server

I have been trying to install OpenEMR 5.0.1 on a hosted server following the instructions at

https://www.open-emr.org/wiki/index.php/Hosted_OpenEMR

I downloaded the OpenEMR 5.0.1 zip file from the Windows section at

https://www.open-emr.org/wiki/index.php/OpenEMR_Downloads

and uploaded it to my hosted account and extracted it.

I created a blank database and user with all privileges and used phpmyadmin to change the database collation to “utf8mb4_general_ci”.

When I go through the install steps in my Chrome browser, I selected that “I have already created the database”

I get an error when I do Step 3:


Step 3

Configuring OpenEMR…

Connecting to MySQL Server… OK.

unable to execute SQL: ‘CREATE TABLE drug_templates ( drug_id int(11) NOT NULL, selector varchar(255) NOT NULL default ‘’, dosage varchar(10) default NULL, period int(11) NOT NULL default ‘0’, quantity int(11) NOT NULL default ‘0’, refills int(11) NOT NULL default ‘0’, taxrates varchar(255) default NULL, PRIMARY KEY (drug_id,selector)) ENGINE=InnoDB’ due to: Specified key was too long; max key length is 767 bytes


I get the same error if I in Step 2 I use Server Host = “localhost” or the IP address assigned to my hosted account.

When I go into the database in phpMyAdmin, it looks like 31 tables are created and some of them have rows added.

I contacted my hosting provider and when they attempted to install OpenEMR they also received the same error. They do not see any server side errors and note that it did connect correctly to the database. They suggested that I reach out to see if there are some recommendations for correcting the problem or possible server side changes/adjustments they may need to make.

I am unable to use the option of having the database create the database because I cannot connect to MySQL as root user on this account.

Thank you in advance.

hi @sj136
What if you use utf8_general_ci instead?
If still not working, what is your mysql version?

hi @brady.miller

I deleted out the openemr database and re-created it and assigned the openemr user to it with all privileges. Then changed the collation to utf8_general_ci in phpmyadmin and then the installation succeeded.

Thank you!

1 Like

Installation error popping up.

unable to execute SQL: ‘CREATE TABLE drug_templates ( drug_id int(11) NOT NULL, selector varchar(255) NOT NULL default ‘’, dosage varchar(10) default NULL, period int(11) NOT NULL default ‘0’, quantity int(11) NOT NULL default ‘0’, refills int(11) NOT NULL default ‘0’, taxrates varchar(255) default NULL, PRIMARY KEY ( drug_id , selector )) ENGINE=InnoDB’ due to: Specified key was too long; max key length is 767 bytes

mysql  Ver 15.1 Distrib 10.1.47-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

PHP 7.4.14 (cli) (built: Jan 13 2021 08:04:06) ( NTS )

Same error. The UTF-8 Collation is set to General(Recommended)

## Innodb settings to bypass error of max size 737
innodb-file-format=barracuda
innodb-file-per-table=ON
innodb-large-prefix=ON
## Above 3 didnot work so i added below
innodb_default_row_format = 'DYNAMIC'

That worked.