Apple only allows you to sync your iPhone with one iTunes library at a time. When you attempt to sync your iPhone to another computer, you get the following message.
Note: “Computer 1” represents your usual computer, “Computer 2” represents the new computer you would like to sync your iPhone to.
On “Computer 2”, backup “iTunes Music Library.xml” and “iTunes Music Library” (Tunes Music Library on Windows) safely.
Download a Hex editor.
1. On Computer 1, open “iTunes Music Library.xml” with Notepad and search (Ctrl+F) for “<key>Library Persistent ID</key>”
2. Following “<key>Library Persistent ID</key>”, copy the code between <string> and </string>
In this example it is “8B6C633F7DACB74B”.
3. On computer 2, find that same code, and replace it with the code from computer 1.
4. Open “iTunes Music Library” (iTunes Library.itl on Windows) using your Hex Editor on computer 2.
5. In the Hex Editor, go to Edit > Replace.
6. In “Find”, insert code from computer 2. In “Replace With”, insert code from computer 1. There should be one match.
7. Save this file. Close it.
8. Start iTunes on computer 2, and plug in your iPhone.
9. Select “Manually manage music and videos”
10. You will no longer be alerted to erase your data.