[mysql] backport rename_index from Rails (corectly handling MariaDB as well)

https://github.com/rails/rails/commit/11338183265f759b07c8dffd526b92
ENV_JAVA (a Java::OrgJrubyJavaUtil::SystemPropertiesMap) does not like replace(arg1)