A driving mechanism for moving an optical element is provided, including a fixed part, a movable part, a driving assembly, and a flexible element. The movable part is connected to the optical element. The driving assembly drives the movable part to move relative to the fixed part. The flexible element is connected to the fixed part and the movable part. When the movable part moves relative to the fixed part, the flexible element deforms so that the position of the movable part relative to the fixed part can be detected.