i think the whole mysql block should be sourrounded by a check if the database is 127.0.0.1/localhost or any other internal ip