diff --git a/entrypoint.sh b/entrypoint.sh
old mode 100755
new mode 100644
index 7398508d6753638e67901cccef9b62c234b6f5ad..216cefe6c8fb84fb5ca2ab65d11454d9a1ef4032
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -14,6 +14,12 @@ sed -i "s/\/var\/www\/html/\/var\/www/g"  /etc/apache2/sites-enabled/000-default
 
 chown -R www-data:www-data /var/www
 
+if [ ! -z "${PIWIGO_MYSQL_ENGINE}" ]; then
+	grep -Rn MyISAM /var/www/install | cut -d: -f1 | sort -u | while read file; do
+		sed -i 's/MyISAM/InnoDB/' "${file}";
+	done;
+fi;
+
 source /etc/apache2/envvars
 apache2ctl -D FOREGROUND