No!
Mental illness is far too broad of a term. There is a wide variety of mental illnesses, and with many of those, people suffering from those symptoms are no threat to others. It is unfair to judge such a wide range of people based on a few, especially when most people have very little understanding of mental illness. It's like saying every black person is prone to commit crime. How about some examples?Should someone with OCD be prevented from owning a gun?
When their mental illness causes them to count their steps and wash their hands three times? Does that make them a threat?
What about someone with social anxiety?
Should someone who is unable to be out in a crowd be prevented from owning a gun? Should the fact they can't shop in a mall or crowded store, that they can't go to a ball game or theater on opening day mean they don't deserve to have a gun?
How about someone with an eating disorder? Or sexual dysfunction? What about if they have their problem under control with medication? Should a diagnosis prevent them from being able to protect themselves?
Last one. (Possibly most important one)
What about someone who has mental illness as a result of abuse, and the reason they want a gun is because they are scared to death or what will happen if their abuser finds them again? Should someone be prevented from owning a gun because of what someone did to them, someone they may need to protect themselves from in the future?
There has been a great deal of research showing how abuse, especially child abuse, can prime the brain for mental illness later in life, most notably anxiety disorders and depression. Dissociation, borderline personality disorder, antisocial personality disorder, eating disorders and more can all be caused partially or entirely by abuse and not one of them makes a person a danger to others.