Copyright is automatically granted to you when you begin creating your work. You don't have to file anything anywhere, or publish anything online to own the copyright of your music.
However, it gets tricky if you ever need to prove this. If there is ever a dispute over the ownership of your copyright, it can be very helpful to have some official documentation filed with the government to back up your claim of ownership. Some people do register their copyright with official organizations, because it can help prevent legal trouble in the future. If you are concerned about whether your own content has been infringed, please find more information about this here.
For information about copyright protection in your country, try your local copyright office.
Please note: This does not constitute legal advice and we would recommend you to seek legal guidance if you need more information on this subject.