Honestly its hard to store Arduino data to MySQL directly so that in addiction to Arduino IDE i used Processing IDE that is similar to Arduino IDE but with lot of different usage and you can able to code it in java.
Note:don't run Arduino serial monitor while running processing code because port conflict will occur as both have to use the same port
You Need:
Arduino Uno/Mega or clone
Wamp server
Processing IDE 2.2.1 (don't use greater than that)
BezierSQLib-0.2.0 library for processing (Download link below)
sensor (I used LDR and LM35 to measure light and temperature)