Transfer data from iPhone with no password to Apple ID My Apple ID got hacked a few months ago and it's still on the iPhone 5 and I can't access the password as it as hacked! 

How can I transfer just the music from iPhone 5 to iPhone 7?
Your question isn't totally clear, so I'm making some assumptions (such as your Apple ID email is still the same and that you're talking about music you've purchased with that Apple ID).

As a starting point, visit iForgot to reset a forgotten password, unlock your account, or recover an Apple ID.

Once you've done that, you can sign in with your new password etc on your iPhone 7 and download any purchases you've made previously. Also, assuming you have a Mac/PC you can also sign in again on iTunes and use iTunes then to sync music etc across.

If I've misunderstood your issue, please clarify your question and let me know.