Apply for and open new credit accounts only as needed. Don't open accounts just to have a better credit mix – it probably won't raise your credit score.
Have credit cards – but manage them responsibly. In general, having credit cards and installment loans (and paying timely payments) will rebuild your credit score. Someone with no credit cards, for example, tends to be higher risk than someone who has managed credit cards responsibly.
Note that closing an account doesn't make it go away. A closed account will still show up on your credit report, and may be considered by the score.