Ensure that the valve actually works and has truly drained the cylinder before you try to remove the valve. You could have a really bad day if you try to remove the valve while the cylinder is still under pressure.
Tapping on the valve with a mallet is bad form and a good way to bend something. Commonly you can bend the valve orifice itself (especially DIN valves), knocking it out of round and preventing the fill whip or regulator from seating properly. You can also bend components of the valve stem.
A better technique is to put a large wrench onto the valve, using the flatforms that are meant for a wrench, then twist off the valve until it is loose enough to be unscrewed by hand. You might need a padded chain clamp to hold the cylinder. Generally I tighten the clamp only just enough to barely keep the cylinder from slipping as I torque the valve with the wrench.
A small amount of an appopriate lubricant on the valve threads helps prevent bimetal galvanic corrosion.
Each cylinder manufacturer requires a certain minimum number of intact threads must be present. Assuming that your latest valid visual inspection has checked this, and assuming that you haven't damaged any threads in the process, then you should be good to go to screw the valve back in place with an appropriate new, unlubricated cylinder neck o-ring.
Each cylinder manufacturer requires that valve be torqued to specs. Almost all require 50 foot-pounds, but it varies from manufacturer to manufacturer. In my experience, 50 ft-lbs is just beyond my ability to tighten by hand. In other words, if I tighten a cylinder valve by hand as tight as possible, I still need a little bit of torque with a torque wrench to get it to 50 ft-lbs. But that's just me, and I know this because I have checked it with a torque wrench.
I use a long-handled torque wrench and crow feet for torquing all of my cylinders. Of course, it should be obvious that the purpose of torquing a valve to specs is to prevent the valve from loosening and turning into a high-power projectile. If you are using DIN valves with twin cylinders and isolation manifold, then it is obviously unlikely that the valve would loosen and spin off under pressure.
All of this is also assuming that this is a scuba cylinder for plain air. If you are doing this for a NITROX cylinder, then you are opening a whole other can of worms in terms of oxygen cleaning the valve, appropriate o-rings and lubricants, etc.