In this article, an optimization based spacecraft trajectory planner for asteroid proximity missions is presented. In asteroid missions, it is of a specific interest to determine the surface and material properties of the target asteroid by obtaining high-resolution measurements from multiple sites over the asteroid surface. During this mission, an important problem to solve is the trajectory planning for the spacecraft, that results into a visual coverage problem for the asteroid surface. However, asteroids provide a challenging target for such missions since they are partially illuminated, rotating, irregular shaped bodies with a low (micro) but irregular gravity field. For addressing this challenging problem, this article will propose a novel optimization approach for the visual coverage of an asteroid. Thus, the proposed trajectory planner's objective is to determine the sequence of the areas to cover and the associated trajectories to achieve this coverage, while considering the motion of the spacecraft, the rotation dynamics of the asteroid, the illumination to each asteroid site and the irregular gravity constraints of the asteroid. The efficacy of the proposed optimal trajectory planner is evaluated through multiple simulation results, where it demonstrates successful optimal coverage of all the desired asteroid areas.