I found this reply (by robtillaart) about that:
To connect an LDR correctly it must be part of a voltage divider
+5V <----> [ LDR ] <-----> [A0] <------> [Resistor] <-----> GND
The value of resistor must be in the same order as the LDR when in the dark. (a 10 K will work probably too)