If the fabric can be washed or at least wiped with a wet sponge, try white vinegar or baking soda. But either is good for removing a mildew odor. You can even follow up one with the other -- usually vinegar first, then baking soda to neutralize the vinegar odor. Don't mix them -- it just makes foam and neutralizes both.
There are also commercially made sprays and liquids that do the same thing. But vinegar or baking soda work pretty well.
A mild solution of bleach works on really tough mildew odors, but is best reserved for towels, wash cloths, dish cloths, maybe some bed linens, that sort of thing. There are commercially made bleach sprays (Clorox and others) that are very convenient and sometimes work better than homemade preparations. In particular I like the Clorox foaming bleach spray for kitchens and bathrooms because it's easier to confine the spray to a specific place. Works on kitchen and bathroom brushes, sponges, etc., too. So far I haven't seen any bleach damage from using these on kitchen and bathroom cleaning cloths, but I'd use it only as a last resort on a backpack, satchel, etc., or clothing.
If in doubt, test it on a mildewy sponge or rag.