Don't. Seriously. By all means, keep a knife on you just in case. But never ever use it as your main weapon. It's so short, you're basically hugging the zombie, but do you really need me to tell you that?
Let's start with one of the most obvious melee weapons: the longspear. This weapon has two main advantages: It has a long reach, so you can kill Zombies from a relative distance. It's relatively easy to build. While it has got its drawbacks (which we'll talk about in a second), this should be one of the first weapons you acquire, as it's just so damn useful.