It's not illegal. You won't go to jail, you won't be arrested, you won't be fined. But you may violate the policies YouTube required you to agree to when you started your channel. And YouTube may therefore delete the offending video.
Most musicians and their labels will allow you to play covers of their songs on YouTube without any problem. Occasionally, one will be flagged as "matched third party content". All that means is that the copyright owner identified it, and they will get some tiny fraction of a penny from YouTube in ad revenue when your video is played. Most musicians and labels realize that it is in their benefit for fans to like their songs and want to play them.
Most, but not all. Every now and then there is some musican (or label, or company given the job of looking after the copyright) who won't allow their songs to be covered. They will tell YouTube they want your video removed. If they control the copyright to that song, YouTube will do as they ask. YouTube will delete your video and give you "a strike" against you. If you get three strikes, YouTube will delete your entire channel. Remember, it is not your song, and you do not control the rights over what use you can make of the song.
The hard part is knowing ahead of time where you might have a problem. I've heard of people having Jimi Hendrix and Supertramp videos deleted, and that Sony doesn't want covers of artists on its label. I've got over 100 cover tunes on video, and I haven't had YouTube delete any. Yet. I self-deleted two Supertramp covers when I heard that was a potential problem. Personally, I don't think the quotes people post about copyright law make any difference, but some people feel that posting that language will protect them.