mysql5 with mac os x

3 May
2009

Use macports to install

sudo port install mysql5 +server

A startup link is prepared. Use these commandos to enable/disable the server AND the auto startup

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist</blockquote>
Generate the connector socket: (Rails, Python and other language may access your  server directly via socket)
<blockquote>sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock
sudo mkdir /var/mysql
sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /var/mysql/mysql.sock

Set up your default user: (change ‘password’ to anything you like)

sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist
sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
mysql5 -u root
UPDATE mysql.user SET Password = PASSWORD('password') WHERE User = 'root';
FLUSH PRIVILEGES;
quit

finally, try to login:

mysql5 -u root -p

If you need to change the default settings, you have to generate my.cnf:

sudo cp /opt/local/share/mysql5/mysql/my-large.cnf /opt/local/etc/mysql5/my.cnf

I altered the max_allowed_package – Setting for [client] to import large mysql dumps.

For connecting, there is a nice cocoa app called Sequel Pro. I like phpmyadmin, so i set up apache+php5+phpmyadmin for that. (its all in macports)

Related posts:

  1. Switching to homebrew
  2. Backup Server with rsnapshot
  3. Database transfer with taps
  4. Clean up after macports
  5. git and cvs turnaround ‘guerilla style’

Comment Form

top

Switch to our mobile site