First: You have a bad cable (or a bad port). Fix that first, as you're bound to have way more issues down the line if you keep hoping for the best with a flaky connection

.
Second: you're doing something wrong. Or macOS is doing something wrong for you; check the mac-specific mentions on those first two post

.