How to install and run two MySQL Server Instances on MacOSX (MySQL 5.6 and 5.7)

# How to install and run two MySQL Server Instances on MacOSX
# MySQL Server 5.6  and Mysql server 5.7


# Mysql Server 5.7
# Download .dmg from mysql.com and install as usually


# Mysql Server 5.6
# Go to mysql.com and download Mysql tgz
# Descompact tgz
tar -xvf mysql-5.6xxx.tgz

# Move mysql to bin dir
sudo mv ~/Downloads/mysql-5.6.xxx /usr/local/

# Install mysql install db system
cd /usr/local/mysql-5.6.34-osx10.11-x86_64
./scripts/mysql_install_db

# edit/add conf options to the default file options
vim /usr/local/mysql-5.6.34-osx10.11-x86_64/my.cnf
#
basedir = /usr/local/mysql-5.6.34-osx10.11-x86_64
datadir = /usr/local/mysql-5.6.34-osx10.11-x86_64/data
port = 3307
server_id = mysqld56
socket = /tmp/mysqld-56.sock
#

# Change dir owner to _mysql
sudo chown -R _mysql /usr/local/mysql-5.6.34-osx10.11-x86_64

# start mysqld
sudo /usr/local/mysql-5.6.34-osx10.11-x86_64/bin/mysqld_safe --defaults-file=/usr/local/mysql-5.6.34-osx10.11-x86_64/my.cnf &

# set root password
/usr/local/mysql-5.6.34-osx10.11-x86_64/bin/mysqladmin -h 127.0.0.1 --port 3307 -u root password your_password_here

# Stop mysqld
sudo killall -9 mysqld

# Find which port mysql is running
sudo lsof -i -P | grep -i "listen"

# References
# https://dev.mysql.com/doc/refman/5.7/en/multiple-servers.html
# https://dev.mysql.com/doc/refman/5.7/en/multiple-unix-servers.html
# https://dev.mysql.com/doc/refman/5.6/en/server-options.html