The first rule should be to keep them to a minimum, but I seem to have been blessed with some kind of trick memory for such things so it's never been an issue for me. I remember our home phone number from when I was 3 years old, for instance--949-8692-- and I know my driver's license number, my Social Insurance number, my passport number, 4 credit card numbers and PINs, all my bank account numbers, and the home and cell phone numbers of everybody I care most about. In addition to those, there are 4 numerical passwords on our home security system, combination locks on the two outbuildings in the yard, a password to access our home voice messaging system, passwords for two computers and a router in the house, and before I retired there were passwords for my office workstation and about a dozen servers and the lock on the computer room door. I never had to look any of them up. Even in cases where password changes every 30 to 90 days were enforced by security policies, I never had a problem. Early on in the electronicization (if that's not a word, it oughta be) of my life I recognized this was going to be an issue, so I spent an hour and invented a dozen passwords no dictionary attack would ever crack but had something about them that was easily memorable to me without being related to anyone's name or birthday. Anyone seeing them written down would think they were just random alphanumeric sequences. Even if I should happen to forget the password for a particular device (it's never happened, but it might as my aging brain weakens... ), I know it's one of a dozen so I can't be locked out permanently. Most computerized systems will allow you three tries to get it right then lock you out for a period ranging from a few minutes to a few hours, then you can try another three, and so on.
The basic trick: think of a memorable line from something you've read or heard, take the initial or final letters of each word, then reverse them or scramble them in some way you can easily remember, throwing in a number when it sounds the same. If you're limited to numbers only, as most bank card PINs require, pick a date that has some significance to you and again scramble the numbers in a way you'll be able to remember.
Some examples: suppose the phrase, "I can't believe I ate the whole thing" stands out in your mind for some reason. Like, you ate the whole thing, felt bloated and stuffed for 2 hours and finally barfed yourself inside out. Take the initial letters and throw in an 8 for ate and you get ICBI8TWT, then reverse them to get TWT8IBCI. Pretty tough to crack that unless someone knows you ate the whole thing, and the aftermath, and presumably they'd be a friend who wouldn't try to hack into your stuff anyway. For numbers, suppose you're of Scots ancestry and the Battle of Culloden still rankles. That was 16/04/1746, so pick some of those numbers, 16041746 (most PINs allow you only 4 or 6 digits) and reorder them in a way you can remember, like use the last four digits in reverse order, 6471.
And the real key to maintaining security: *never* tell anyone what your codes are, or how you arrived at them. Any computer support person or phone company technician or bank employee or whatever who claims to need to know them in order to help you is incompetent or lying, and probably both. Nobody ever needs to know anything about them but you.
And just in case any of you are wondering, the answer is no, the examples I gave have nothing to do with the way I did it for myself.