avoid error if mysql is not yet connected by doing is_local check first