Installing MySQL51 Using MacPorts from Scratch for Lion

  1. Install the packages
    1. sudo port install mysql51 mysql51-server
  2. Initialize the db
    1. sudo -u _mysql /opt/local/lib/mysql51/bin/mysql_install_db
  3. Make mysql51 the default
    1. sudo port select mysql mysql51
  4. Run the daemon
    1. cd /opt/local ; sudo /opt/local/lib/mysql51/bin/mysqld_safe &
  5. Check to see its working by running mysql -uroot which should bring you into the interactive mysql shell as root user
  6. Setup
    1. /opt/local/lib/mysql51/bin/mysql_secure_installation

Other Notes:

  • 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
Advertisements

One thought on “Installing MySQL51 Using MacPorts from Scratch for Lion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s