refactoring and enable remote mysql setup