Above does the trick. Another thing to note – don’t try to connect root from network machines as mostly when we install MySQL we disable root to be accessed locally. Create a new user.
Also don’t forget to restart mysql and may be apache as well.
1 brew services restart httpd