Mac : Installing Mysql on mac using brew

Look, if you just want to try out mysql only for learning then there is not need for local installation, you can try it out free at this site : http://demo.phpmyadmin.net/master-config/

If you want to install Mysql on you mac machine then follow below steps :

  1. Install mysql with brew install mysql
  2. Start mysql with mysql.server start
  3. Connect mysql with mysql -uroot 
  4. Stop mysql with mysql.server stop

 

Note :

To have launchd start mysql at login:

  ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

Then to load mysql now:

  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Or, if you don’t want/need launchctl, you can just run:

$   mysql.server start

$ mysql -uroot

mysql.server stop

Once Mysql is installed you can check port number using below command

mysql> SHOW GLOBAL VARIABLES LIKE ‘PORT’;

+—————+——-+

| Variable_name | Value |

+—————+——-+

| port          | 3306  |

+—————+——-+

1 row in set (0.00 sec)