MySQL screwed up after brew upgrade

PROBLEM
I ran 

brew upgrade

It updated my mysql installation to  8.0.12. Previously I was working with 5.7.22. Now each time I start mysql using the following commands

mysql.server start

OR

brew services mysql restsrt 

MySQL does not start properly

 Most probably the error you will face is 

.. ERROR! The server quit without updating PID file

SOLUTION 

When I run 

mysql --version

I notice that the version was Ver 8.0.12 for osx10.12 on x86_64 (Homebrew )

So I also figured that if I use the previous version this error would not occur.  To check the previous version use the following command

ls /usr/local/Cellar/mysql

the above command gave me an output as follows 

mysql versions

So I found the following command to switch back

brew switch mysql 5.7.22

replace the version with whatever the version you need

brew switch mysql <version>