mysql starts and stops servers automatically non stop I am working on macOS High Sierra.

Basically, the problem is that for some reason the mysql server is starting and stopping automatically, and constantly. It does not stop. If I run:

# ps -ax | grep mysql


to see the processes even when I (think) I have uninstalled mysql, it shows:

54948 ttys002    0:00.00 grep mysql


I run the same thing 5 seconds later, and it has a different ID:

54950 ttys002    0:00.00 grep mysql


I cannot sudo kill -9 54950 because by the time I try to kill it, it has already disappeared.

I have tried removing everything related to mysql. I then reinstall it, and the same thing happens. I have tried doing this with homebrew as well.

Please help.
Of course you will see your terminal running the grep command .. that's pretty much to be expected. Please learn some console basics (either mac os or free bsd related  as that is the underlaying system that mac os builds on )

If ps -> grep really only shows its own instance then there is nothing else with "mysql" in its process name. 
Which pretty much explains that you cant kill the process afterwards - because the console-command did its work and then the process ended regularly. Hence your second attempt "generated" a new process ID (new process) ...

At the time of your ps -> grep NO "other" mysql process is running.