How do I change the Android Market email? I bought a second-hand mobile. 

When I open Market it asks for the password of another account. I don't know how to change the account. 

Also, when I go to the Google Play Store and try to download something it is says that the id is missing even when I have signed in to my gmail account.
You can factory reset your phone, in that you can add a new google account. 


  
  Before you reset your Android One, see options for backing up your data.
  On your mobile device, open the Settings menu.
  Under "Personal," touch Backup &amp; reset. You may need to enter your - pattern, PIN, or password.
  Under "Personal data," touch Factory data reset.
  Read the information on the screen and touch Reset phone.
  If you have a screen lock, you'll need to enter your pattern, PIN, or password.
  When prompted, touch Erase everything to erase all data from your device's internal storage.
  When your device has finished erasing, select the option to reboot your device.
  


Now just add new gmail account by going to settings  --> Accounts --> Add New Account. Add your gmail account.  

Original Source:

https://support.google.com/android-one/answer/6088915?hl=en

Hope that helps !!