1 In the “local case”, are you 100% sure that there exists a MySQL user whose credentials match what’s in the openmrs-runtime.properties file:
connection.username=...
connection.password=...
2 In the “remote case” I would look at what this wait-for-it.sh script does and I would try to make it work in isolation of the whole shebbang here. What’s in that script?