MySQL, PhpMyAdmin & Apache on MacOS Sierra

I experienced some issues running MySQL on my laptop for some reason. It constantly kept giving me an error: access denied for user @’localhost’ (using password: yes). I solved it by uninstalling completely MySQL and reinstalling again. But instead of using MySQL installer, I used Brew for installing MySQL and it worked. Below are the short steps of what I have done.

For installing phpmyadmin and apache server follow this awesome tutorial.
Stop when you finish installing PhpMyAdmin and skip the section where he talks about installing mysql. DO NOT connect Php and MySQL. Instead use an alternative method presented below.

Installing mysql on Mac OS Sierra.
Use Brew to install mysql as suggested in the link below. Just follow what it says in the tutorial here.

    Commands to manipulate with mysql server:
  • brew services start mysql
  • brew services restart mysql
  • brew services stop mysql

This Github code will install mysql on your computers without a password. But the password will be needed for accessing phpMyAdmin later.That is why you need to do the following:

  1. run mysql server: brew services start mysql
  2. change the password for your root user: /usr/local/bin/mysqladmin -u root password root
  3. restart the server: brew services restart mysql
  4. update your password and username in file
  5. this should let you have access to: http://localhost/~username/phpmyadmin/
Written on January 16, 2018