Cooked vegetables contain a lot of moisture. This moisture makes vegetables a particularly inviting environment for bacteria, such as salmonella and Staphylococcus aureus, that can cause foodborne illness. These harmful microorganisms also need certain temperature ranges to multiply to dangerous levels. Leaving cooked vegetables unrefrigerated keeps the vegetables at the perfect temperature for bacteria to grow and multiply.
Bacteria don't readily multiple in low temperatures. To keep cooked vegetables safe, store them in a shallow container and get them in the refrigerator within two hours after they've finished cooking. If you're serving your vegetables in an area where the temperature is 90 degrees Fahrenheit or above, get your leftover cooked vegetables into the refrigerator within one hour.
If you've promptly stored your cooked vegetables in the refrigerator, they'll be safe to eat for a few days. Ensure they're safe to eat and still taste great by eating them within three to four days.