iCloud Music Library broke my local iTunes library

I enabled iCloud Music Library on 10.10.4 this morning. After a few minutes of syncing, almost all of my local tracks had a cloud with an x icon next to them, and most of my playlists had a lot of their songs missing. I also noticed that it had deleted the local copies of a lot of my tracks.

I restored the whole iTunes folder from a previous backup and I am back where I stated, but is there any way to sign up for this and not break my local library? It may be relevant that I signed up for Apple Music on my iPhone before I launched iTunes on 10.10.4
Try turning off iCloud music library from settings>music. after that sync your iPhone with your iTunes account.
after sync is complete again turn on the iCloud music library and chose option merge. it will retain all the data..

Original thread: https://forums.imore.com/threads/icloud-music-library-broke-my-local-itunes-library.333339/