- Install the packages
- sudo port install mysql51 mysql51-server
- Initialize the db
- sudo -u _mysql /opt/local/lib/mysql51/bin/mysql_install_db
- Make mysql51 the default
- sudo port select mysql mysql51
- Run the daemon
- cd /opt/local ; sudo /opt/local/lib/mysql51/bin/mysqld_safe &
- Check to see its working by running mysql -uroot which should bring you into the interactive mysql shell as root user
- For MySQL51, running cd /opt/local/mysql-test ; perl mysql-test-run.pl results in an error Can’t open perl script “mysql-test-run.pl”: No such file or directory. This is a reported bug.
- Using zsh, running which mysql results in mysql: aliased to nocorrect mysql. To see the path. If you’re having problems getting mysql command to work, try this solution.
- If you’re running into this error while connecting to MySQL Work Bench or Sequel Pro, MySQL said: Lost connection to MySQL server at ‘reading initial communication packet’, system error: 61, the fix is to comment out skip-networking in the my.cnf or macports-default.cnf file found at /opt/local/etc/mysql51