Medieval folk didn't drink alcohol to avoid dirty water

Did they do cooking? I seem to remember that hard tack (a dry biscuit), dryed and preserved meats and such were the standard foods. Plus they never went very far from land.